Question : Format Image with VBA

What is the proper syntax to format an image as "Behind Text" with VBA.

For Example, I have this code:

Selection.InlineShapes.AddPicture FileName:=FileName.Jpg

Now how can I format that image so that the image is behind text (equivilant to Format | Picture | Layout | Behind Text).

Thanks

Answer : Format Image with VBA

HI DRJ

The only way i can think is to convert the inlineshape to a shape and then set the zorder.

Building on your code...

' Add image
Set inlineimg = Selection.InlineShapes.AddPicture(FileName:=FileName.Jpg)

' Convert to shape
Set tmpImg = inlineimg.ConvertToShape

' Move behind text
tmpImg.ZOrder msoSendBehindText

' Tidy up
Set tmpImg = Nothing
Set inlineimg = Nothing

HTH

Scott
Random Solutions  
 
programming4us programming4us