Use VBA to insert a picture

  • Thread starter Thread starter jlawson
  • Start date Start date
J

jlawson

I can create code to insert a picture after a bookmark but I want the
picture to be behind the text instead of inline with it. The code is
based off of a userform that has a combo box that lists names of
pictures. Here is what I have gotten:

Private Sub CmdOK_Click()
physig = UserForm1.ComboBox2
ActiveDocument.Bookmarks("sig").Range.InlineShapes.AddPicture
FileName:="C:\PhyData\" & physig & ".JPG", _linktofile:=False,
savewithdocument:=True
End Sub

Thank you for any help! This message board has been wonderful!

-Josh
 
Hi Jlawson,
I can create code to insert a picture after a bookmark but I want the
picture to be behind the text instead of inline with it. The code is
based off of a userform that has a combo box that lists names of
pictures. Here is what I have gotten:

Private Sub CmdOK_Click()
physig = UserForm1.ComboBox2
ActiveDocument.Bookmarks("sig").Range.InlineShapes.AddPicture
FileName:="C:\PhyData\" & physig & ".JPG", _linktofile:=False,
savewithdocument:=True
End Sub
You need to use .Range.Shapes.AddPicture

Or you need to take the inline shape and use the .Convert method to
turn it into a Shape.

Please note that you'll get a generally better response time in a
word.vba newsgroup. This newsgroup is targeted at end-users...

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)
 

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

Back
Top