removing pictures via macro

J

Jay Freedman

DaveJ said:
How can I remove all pictures in a document via a Word 2002 macro?

Hi Dave,

I'm afraid your requirements are a little under-spec'ed.

The following simple macro will delete all floating and inline graphics (and
textboxes, too) from the body of the current document. It won't touch
anything in the headers or footers, footnotes, endnotes,... See
http://word.mvps.org/faqs/macrosvba/FindReplaceAllWithVBA.htm for an
explanation of all the storyranges in a document.

Sub DeleteGraphics()
Dim oShp As Shape
Dim oIlShp As InlineShape

For Each oShp In ActiveDocument.Shapes
oShp.Delete
Next oShp

For Each oIlShp In ActiveDocument.InlineShapes
oIlShp.Delete
Next oIlShp
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top