I have NO idea why you might want to do this, but figured I’d share these two macros — one is to delete all tables, and the other is to delete all figures from a Word document.
The macro to delete all tables is from Allen Wyatt’s Word VBA Guidebook (http://store.tips.net/T010353_Word_VBA_Guidebook_Table_of_Contents.html); the one to delete all figures was one I created based on the tables one. However, it wasn’t easy! Unlike tables (Table object), figures aren’t under normal words like ‘figure’, ‘picture’, ‘photo’, ‘diagram’, or ‘image’ — no, they are part of the InlineShape object! That bit of information took some time to find.
Word VBA Guidebookhttp://store.tips.net/T010353_Word_VBA_Guidebook_Table_of_Contents.htmlTableInlineShapePlease use with caution — these macros WILL delete every table or figure, except those in your document’s headers and footers.
Sub TablesDeleteAll() Dim tbl As Table For Each tbl In ActiveDocument.Tables tbl.Delete Next tbl End Sub
Sub FiguresDeleteAll() Dim fig As InlineShape For Each fig In ActiveDocument.InlineShapes fig.Delete Next fig End Sub
[Links last checked June 2011]