Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / September 2005

Tip: Looking for answers? Try searching our database.

removing pictures via macro

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
DaveJ - 20 Sep 2005 17:59 GMT
How can I remove all pictures in a document via a Word 2002 macro?
Jay Freedman - 20 Sep 2005 18:43 GMT
> 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

Signature

Regards,
Jay Freedman
Microsoft Word MVP          FAQ: http://word.mvps.org

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.