Solved

MS word Macro insert picture with "behind text" attribute

Posted on 2012-04-04
4
1,022 Views
Last Modified: 2016-10-29
Here is what I have for the macro, I want the image to be behind the text.  What am I missing?
Thanks,
John

Sub test()
'
' test Macro
'
'
    Dim shp As Shape
    Set shp = ActiveDocument.Shapes.AddPicture( _
        FileName:="C:\jkf.bmp", _
        SaveWithDocument:=True, _
        Anchor:=ActiveDocument.Paragraphs(1).Range, _
        Left:=InchesToPoints(3), _
        Top:=InchesToPoints(5.5), _
        Width:=InchesToPoints(2.5), _
        Height:=InchesToPoints(0.9))
End Sub
0
Comment
Question by:John_Fretz
  • 2
4 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 37809842
You need to change the WrapFormat Type:
Sub test()
'
' test Macro
'
'
    Dim shp As Shape
    Set shp = ActiveDocument.Shapes.AddPicture( _
        FileName:="C:\jkf.bmp", _
        SaveWithDocument:=True, _
        Anchor:=ActiveDocument.Paragraphs(1).Range, _
        Left:=InchesToPoints(3), _
        Top:=InchesToPoints(5.5), _
        Width:=InchesToPoints(2.5), _
        Height:=InchesToPoints(0.9))
    With shp.WrapFormat
        .Type = wdWrapBehind
    End With
End Sub

Open in new window

0
 

Author Closing Comment

by:John_Fretz
ID: 37810822
Thanks for the help.<br />Cheers,<br />John
0
 

Expert Comment

by:Jorge GONZALEZ
ID: 41864571
May I have your help? where is the error?

Sub Firma_JoGo()
'
' Firma_JoGo Macro
' Esta Macro inserta la Firma


'a) create new shape as object variable
Dim SHP 'As InlineShape/As Shape
Set SHP = Selection.InlineShapes.AddPicture(FileName:="C:\Users\Jorge Gonzalez\OneDrive\Imágenes\Firma JoGo.jpg", LinkToFile:=False, SaveWithDocument:=True)
'b) changes made according to SHP variable:
With SHP
    'this will convert to shape 'in front of text' then 'Behind the Text'
    .ConvertToShape
    WrapFormat.Type = wdWrapBehind

 
End With


End Sub
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 41864953
Jorge GONZALEZ
Please open a new question. That way all experts who monitor the MS Word zone will be notified. Only contriburos to this question (two people) will be notified of your comment.
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Nice table. Huge mess. Maybe this was something you created way back before you figured out tabs or a document you received from someone else. Either way, using the spacebar to separate the columns resulted in a mess. Trying to convert text to t…
Microsoft Word is a program we have all encountered at some point, but very few of us have dug deep into its full scope of features, let alone customized it to suit our needs. Luckily making the ribbon (aka toolbar, first introduced in Word 2007) wo…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now