Programmatically set wrapping style

M

mc

Does anyone know if you can set the wrapping style of objects within a word
document programmatically using the word interop assemblies. I would like to
always set the layout to "inline with text" before saving a document. Again
this would be programmatically.

Regards,
mc
 
C

Charles Kenyon

I believe the wrapping style applies to individual objects rather than to
the document as a whole.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
M

mc

How about getting a list of the objects within the document and setting each
to "inline with text".
 
C

Charles Kenyon

You don't need to get a list, simply cycle through the collection.
--
Charles Kenyon

Word New User FAQ & Web Directory: http://addbalance.com/word

Intermediate User's Guide to Microsoft Word (supplemented version of
Microsoft's Legal Users' Guide) http://addbalance.com/usersguide

See also the MVP FAQ: http://www.mvps.org/word which is awesome!
--------- --------- --------- --------- --------- ---------
This message is posted to a newsgroup. Please post replies
and questions to the newsgroup so that others can learn
from my ignorance and your wisdom.
 
C

Chuck

When you a picture's wrap style to "in line with text" from any other, you're
changing it from a Shape to an InlineShape. The following code loops through
all the Shapes in your document and converts them to InlineShapes. HTH

Sub ShapeToInLineShape()

Dim shpShape As Shape
Dim rngRange As Range
Dim hf As HeaderFooter
Dim i As Long

With ActiveDocument

For Each rngRange In .StoryRanges
For Each shpShape In .Shapes
shpShape.ConvertToInlineShape
Next shpShape
Set rngRange = rngRange.NextStoryRange
Next

For i = 1 To .Sections.Count
For Each hf In .Sections(i).Headers
For Each shpShape In hf.Shapes
shpShape.ConvertToInlineShape
Next shpShape
Next hf
For Each hf In .Sections(i).Footers
For Each shpShape In hf.Shapes
shpShape.ConvertToInlineShape
Next shpShape
Next hf
Next i

End With

End Sub
 

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