I tried to run the macro to remove captions in all tables in a document.
Code:
Sub delTableCaptionAll()
Dim ctr As Integer
Dim txt As String
Dim Check As Boolean
Dim para As Paragraph
ctr = 0
For Each para In ActiveDocument.Paragraphs
txt = para.Range.Text
Debug.Print txt
Check = InStr(txt, "Table")
Debug.Print Check
If Check = True And para.Range.Style = "Caption" Then
para.Range.Delete
End If
ctr = ctr + 1
Debug.Print ctr
Next
End Sub
The problem is it doesn't remove the line (image attached) after the caption is deleted. How can I remove the space after the caption is deleted ?
Thanks