using vba to wrap text around picture

B

bruceb

How do I get vba to wrap text around a pic? I was able to
insert a jpg pic from a file. I know I can do it by hand,
using the format picture default window, but that part is
disabled if I try record-macro. I have also looked at the
shapes and inlineshapes objects, but nothing I have tried
seems to work. I tried the following:

ActiveDocument.Shapes(1).WrapFormat.Type = wdWrapSquare
ActiveDocument.Shapes(1).WrapFormat.Side = wdWrapLeft

But it gives me the error message 'the index into the
specified collection is out of bounds'

This pic is the only pic in the document.

Thanx, BruceB
 
J

Jean-Guy Marcil

bruceb said:
How do I get vba to wrap text around a pic? I was able to
insert a jpg pic from a file. I know I can do it by hand,
using the format picture default window, but that part is
disabled if I try record-macro. I have also looked at the
shapes and inlineshapes objects, but nothing I have tried
seems to work. I tried the following:

ActiveDocument.Shapes(1).WrapFormat.Type = wdWrapSquare
ActiveDocument.Shapes(1).WrapFormat.Side = wdWrapLeft

But it gives me the error message 'the index into the
specified collection is out of bounds'

This pic is the only pic in the document.

Is this sole picture inline with text or floating?
If it is inline, then you want to use this before setting the wrapping:
ActiveDocument.InlineShapes(1).ConvertToShape


--
Salut!
_______________________________________
Jean-Guy Marcil - Word MVP
[email protected]
Word MVP site: http://www.word.mvps.org
 
Top