Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table Caption Deletion

Status
Not open for further replies.

tyang01

Technical User
Feb 1, 2007
46
US
Hi I was wondering if there is a way to automate deletion of table and figure captions?

I've tried:

Selection = ActiveDocument.TablesOfFigures(2)
Selection.Delete

and other alternatives if you have any suggestions please let me know.

Thanks.
 
Table and Figues Captions has no direct relation to the table and figures they caption. They are simply paragraphs in a specific ("Caption") style.
Code:
Selection = ActiveDocument.TablesOfFigures(2)
That is an interesting line of code. Could you elaborate?

Are looking to delete the actual paragraph lines "Table 1", "Figure 2" etc.? Or are you trying to delete a Table of Figures?

If you are trying to do the former, then:
Code:
Sub RemoveCaptions()
Dim oPara As Paragraph
For Each oPara In ActiveDocument.Paragraphs
   If oPara.Style = "Caption" Then
      oPara.Range.Delete
   End If
Next
End Sub
does that.

BTW: as you seem to be posting this as a code question, please post to the VBA forum.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top