Picture Into Word

A

ACFalcon

I am needing help with working on a Word document from vb.net 2003. I need
to insert images into a word document at certain places in the text (using
VBA). I have tried using the code below, but I only get an unrecognizable
character where the image should be. Does anyone have any ideas of what I
can do?

oDoc.Sections.Add()

oDoc.Sections(a).Range.InlineShapes.AddPicture(FileName:=<<ImagePath>>,
LinkToFile:=True, SaveWithDocument:=True,Range:=oDoc.Sections(a).Range)

**I have tried this with the LinkToFile value as both True & False.

I know the image will insert correctly because I can insert it into the
documents using this code, but of course this code inserts it over the text
at the very first of the document.

oDoc.Sections.Add()

oDoc.Shapes.AddPicture(FileName:=<<ImagePath>>)

Please help!

Thanks,

Adam
 
D

Doug Robbins - Word MVP

You need to be precise about where you want the image and it is often
easiest to insert it into a one cell table that you locate where you want
the image to appear.

oDoc.Tables(1).Cell(1, 1).Range.InlineShapes.AddPicture
Filename:=ImagePath


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP
 
A

ACFalcon

Thanks for the reply, unfortunately when I try putting the image into a table
all I get is the same unrecognizable character (the small rectangle). I am
able to manually insert the images I am attempting to input, but
programmatically I keep receiving this weird character. Any ideas?

Thanks,
Adam
 

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

Top