Solved

MS word Macro insert picture with "behind text" attribute

Posted on 2012-04-04
4
1,333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Shortcuts in Word Just the other day I had a training for Microsoft and they wanted me to show how well the new Windows and Office behaved on a touch device, which by the way is great, but it was only then that I realized that using keyboard shortc…
Ever visit a website where you spotted a really cool looking Font, yet couldn't figure out which font family it belonged to, or how to get a copy of it for your own use? This article explains the process of doing exactly that, as well as showing how…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

717 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