Link to home
Start Free TrialLog in
Avatar of zippy221
zippy221

asked on

Insert Image into Word Document Bookmark

I have a template set up in Microsoft Word.  There is a bookmark called IMAGE, and that is where I want to insert an image if one is selected from my VB program.  In my VB program I am using a common dialog box to allow people to choose an image and then I have a picture box called picture1 that displays the image, so that a person can see if he/she likes the image before creating the word document with the image in it... the only problem is that I am having trouble inserting the image.  I have tried copying it to the clipboard and pasting it in the bookmark, but that didn't seem to work...here is what I have so far:

    ElseIf UCase$(lsBookmarkName) = "IMAGE" Then
        Clipboard.Clear   ' Clear Clipboard.
        Clipboard.SetData LoadPicture(Me.CommonDialog2.FileName)
       loWord.Bookmarks("IMAGE").Select
       ActiveWindow.ActivePane.Selection.Paste

For some reason it puts whatever is in the next bookmark in the place where I have the IMAGE bookmark...
ASKER CERTIFIED SOLUTION
Avatar of schworak
schworak

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of zippy221
zippy221

ASKER

Works like a charm!  Thanks!