Macro for deleting mult. pictures in word

H

Howard Irwin

I need a macro for deleting multiple pictures (over 400) in a 2003 word
document.
 
J

Jean-Guy Marcil

Howard Irwin said:
I need a macro for deleting multiple pictures (over 400) in a 2003 word
document.

What Word version?

Do you want to delete all pictures in the document or just some of them?
Are all pictures floating or inline with text, or a mix?
Why do you need a macro? Are you going to do this often?

Have you tried writing the macro? Do you have any code?
 
J

Jay Freedman

Howard said:
I need a macro for deleting multiple pictures (over 400) in a 2003
word document.

You don't need a macro for this.

Open the Replace dialog and click the More button. Click the Special button
at the bottom and choose "Graphic" from the popup menu. This places the code
^g in the Find What box. Leave the Replace With box empty and click the
Replace All button.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jay Freedman

Jay said:
You don't need a macro for this.

Open the Replace dialog and click the More button. Click the Special
button at the bottom and choose "Graphic" from the popup menu. This
places the code ^g in the Find What box. Leave the Replace With box
empty and click the Replace All button.

I have to (possibly) overrule myself -- this will remove only in-line
graphics, not floating ones.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
J

Jean-Guy Marcil

Jay Freedman said:
You don't need a macro for this.

Open the Replace dialog and click the More button. Click the Special button
at the bottom and choose "Graphic" from the popup menu. This places the code
^g in the Find What box. Leave the Replace With box empty and click the
Replace All button.

Any way to make this work with floating gaphics? Or am I missing someting
easy (again!)?
 
J

Jay Freedman

Jean-Guy Marcil said:
Any way to make this work with floating gaphics? Or am I missing
someting easy (again!)?

No, I think floating graphics will require a macro. This works, but only for
graphics in the main body of the document:

Sub demo()
Dim oShp As Shape
Dim oIShp As InlineShape

For Each oShp In ActiveDocument.Shapes
oShp.Delete
Next

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

If there are also graphics in headers, footers, and other stories, the usual
folderol is needed
(http://www.word.mvps.org/FAQs/MacrosVBA/FindReplaceAllWithVBA.htm).

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

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