delete a graphic

  • Thread starter Patrick Simonds
  • Start date
P

Patrick Simonds

How can I, using code, do a search for a graphic called Mickey1 have it
selected and then deleted?
 
J

Jezebel

ActiveDocument.Shapes("Mickey1").Delete

If it's an inline graphic it will be in the InlineShapes collection instead
of Shapes.

You don't need to select things to work with them in VBA, apart from columns
in non-uniform tables.
 
P

Patrick Simonds

This did not seem to work.

I have inserted the picture (a scanned signature) and have set it up as a
floating picture so that it floats above any text. I tried your code but I
get an "Item with specific name not found". The name of the graphic I
inserted was mickey1.gif. I tried both Mickey1 and Mickey1.gif in the code
provided.
 
P

Patrick Simonds

Solved the problem. I recorded a macro and altered the picture and when I
viewed the macro I found that while the name of the picture I had imported
was mickey1, word called it picture 3.
 
J

Jezebel

It was called 'Picture 3' only because it was the third picture you
imported. The macro won't work on other graphics.

I assumed from your original post that you had actually named the graphic,
along the lines of

ActiveDocument.Shapes("picture 3").Name = "Mickey1"
 

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