Wrapformat inline shapes

P

Post Tenebras Lux

I would like to cycle thru the inline shapes collection to change the
wrapformat property of each shape to wdWrapTight.

My code:

Dim shp as Shape
Dim shps as Shapes
set shps = ActiveDocument.Shapes

For Each shp in shps
if shp.Type = msoPicture then
with shp
.Wrapformat.AllowOverlap = True
.WrapFormat.Type = wdWrapTight
end with
End if
Next 'shp

This doesn't seem to do anything to the document's pictures (though it does
run).

I've tried using a collection of inlineshapes, but that doesn't seem to
allow the .WrapFormat property

Using record macro, I get the following code:
Selection.ShapeRange.WrapFormat.Type = wdWrapTight

but I can't figure out how to use this syntax with a collections object, to
go through all the pictures in the document.

What am I doing wrong?

A second minor question: Using the Watch window, I can see the shape
properties of the current shp object. How can I match the ID or name of the
shape object to the actual picture object in the document, so that I can
visually check that something is happening to it (I have a lot of pictures in
this document - and I don't know which is the current shape object my code is
working on). I can't find anyway to show the properties of the picture
object in Normal (or any other view).

Thanks!
 
J

Jonathan West

What am I doing wrong?

You aren't converting the InlineShapes to Shapes first. Only Shapes can
allow text to be wrapped, and so only Shapes have a Wrapformat.
A second minor question: Using the Watch window, I can see the shape
properties of the current shp object. How can I match the ID or name of
the
shape object to the actual picture object in the document, so that I can
visually check that something is happening to it (I have a lot of pictures
in
this document - and I don't know which is the current shape object my code
is
working on). I can't find anyway to show the properties of the picture
object in Normal (or any other view).


Select the Shape (or InlineShape) object.
 
P

Post Tenebras Lux

thanks, but I'm trying to automate (cycle thru) 100 shape objects. I know
how to do it manually.
 
P

Post Tenebras Lux

After I select the Shape object (in the document - not via code), where do I
find the value for the ID or object name?
 
J

Jonathan West

Post Tenebras Lux said:
thanks, but I'm trying to automate (cycle thru) 100 shape objects. I know
how to do it manually.

I'm not telling you ho to do it manually. I'm telling you to use the Select
method to show on the editing window which object your code is working on.

You can also pick up the Name property of the object. The Names of all
Shapes and InlineShapes in a document are unique.
 

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