View Single Post
 
Old 08-04-2019, 10:30 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 4,176
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

You will need a second bite at it if the caption is followed by a table since the paragraph mark remains if the paragraph contains any content.
Code:
Sub delTableCaptionAll()
  Dim ctr As Integer, aRng As Range
  Set aRng = ActiveDocument.Range
  With aRng.Find
    .Text = "Table"
    .ClearFormatting
    .Style = "Caption"
    .Forward = True
    Do While .Execute
      aRng.Paragraphs(1).Range.Delete
      If aRng.Paragraphs(1).Next.Range.Information(wdWithInTable) Then
        aRng.Delete
      End If
      ctr = ctr + 1
    Loop
    Debug.Print ctr
  End With
End Sub
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote