How to get total count of pictures for a macro?

R

Ryan Dunn

I need to write a macro that will operate on all the pictures in a document.
I've had trouble finding an answer on the internet. I did find how to get
the total table count, which I needed also:
ActiveDocument.Tables.Count
but there doesn't seem to be anything like that for Figures/Graphics/Pictures.

Anyone have any ideas?

Thanks,
Ryan
 
M

macropod

Hi Ryan,

Graphics and OLE objects are 'Shapes', of which there are two kinds - Floating
& Inline. You can test for both via something like:

Sub Test()
With ActiveDocument
MsgBox "Floating Shapes: " & .Shapes.Count & _
vbCrLf & " Inline Shapes: " & .InlineShapes.Count
End With
End Sub

Cheers

--
macropod
[MVP - Microsoft Word]


| I need to write a macro that will operate on all the pictures in a document.
| I've had trouble finding an answer on the internet. I did find how to get
| the total table count, which I needed also:
| ActiveDocument.Tables.Count
| but there doesn't seem to be anything like that for
Figures/Graphics/Pictures.
|
| Anyone have any ideas?
|
| Thanks,
| Ryan
 
J

Jezebel

Bear in mind that the Shapes collection can include a lot of things that
aren't graphics (like textboxes). If you just want graphics you need to
iterate the collection and check the Type property of each.
 

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