Hello everyone.

Please, I would like your help to the following issue.

I have tried a lot to find the code to create a macro on MS Word. The macro I am trying to create, I need to make the following:

Let’s say I have 4 .jpeg files. I insert these 4 files in a Word document via:

Insert → Picture → From file…

As far as it concerns wrapping text and the pictures, by default, the four pictures will be inserted in the document “In Line With Text”. I want to create a macro that will search all document, and every picture will find, to convert it to “In Front Of Text”.

At the moment, without this macro, I have to make it manually:select one by one all pictures, and convert every time selected one to “In Front Of Text”.

Is there a code to create such a macro?

Thank you for your time!

5 Spice ups

This may do what you are looking for. Create it as a macro, and run it after you’ve inserted all the pictures. Good luck!

Sub testing()
Dim shp As InlineShape
For Each shp In ActiveDocument.InlineShapes
If shp.Type = wdInlineShapePicture Then
shp.ConvertToShape.WrapFormat.Type = wdWrapFront
End If
Next shp
End Sub

4 Spice ups

I’m sure you are asking for a good reason, but just want to put in a warning here for random people reading this from an internet search:

Pulling all the pictures in an existing document to “in front of text” will really mess up your document, and doing it one by one would normally be better so that you can make sure the document is still legible.

4 Spice ups

That’s perfect!!

This is the code I was looking for:the code created the macro I wanted. Thanks a lot!!

1 Spice up