Select All inline shapes

T

tjtjjtjt

New to VBA and trying something I had hoped would be simple:
Select and resize all inline objects in a document. So far, I cna't even get
out of the block: I can only select one object at a time. I have to do this
for a large number of documents Each document will have a different number of
inline pictures. Any help would be greatly appreciated.

tj
 
D

Doug Robbins

You will have to do them one at a time using:

Dim ilshape As InlineShape
For Each ilshape In ActiveDocument.InlineShapes
'Do stuff here
Next


--
Please respond to the Newsgroup for the benefit of others who may be
interested. Questions sent directly to me will only be answered on a paid
consulting basis.

Hope this helps,
Doug Robbins - Word MVP
 
J

Jay Freedman

tjtjjtjt said:
New to VBA and trying something I had hoped would be simple:
Select and resize all inline objects in a document. So far, I cna't even get
out of the block: I can only select one object at a time. I have to do this
for a large number of documents Each document will have a different number of
inline pictures. Any help would be greatly appreciated.

tj

Hi tj,

Even in VBA you can't "select" all the inline objects at once.
Instead, you use a For Each loop and change them one at a time...

Within a loop that opens each document in turn, assigning it to a
Document object named oDoc, the inner loop would look something like
this:

Dim ILS As InlineShape
For Each ILS In oDoc.InlineShapes
ILS.Height = ...
ILS.Width = ....
Next ILS

With this construction you don't need to know how many objects there
are -- or even whether there are any.
 

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