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
(e-mail address removed)
Word MVP site: http://www.word.mvps.org
 

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