Word Automation, picture sizing

G

Guest

I am having trouble sizing a picture after inserting it into Word using
VB.NET. I have a Windows form that allows a user to select several pictures
from file. They can then export those pictures to a Word document. I can
control the size of the picture on my form using a picture box, but how can I
size it in Word, using VB.NET, after I have inserted it? I want to force the
picture to a certain size. I tried using a template, but the picture was not
forced to the size of the image on the template. Below is what I have so far:

Dim oWord As Word.Application
Dim oDoc As Word.Document

'Start Word
oWord = New Word.Application()
oDoc = oWord.Documents.Add

oWord.Visible = True
oDoc.InlineShapes.AddPicture(fileName:=pic1, _
LinkToFile:=False, SaveWithDocument:=True)

This creates a word document with the picture in it, but the picture is much
bigger than I want. I want to be able to give the picture a specific size in
Word. Any ideas?
 
F

fred

I haven't tried it but I suggest something like:

Dim oPic as Word.InlineShape
oPic = oDoc.InlineShapes.AddPicture(fileName:=pic1, _
LinkToFile:=False, SaveWithDocument:=True)
oPic.Height = 10
oPic.Width = 10

Good luck
Fred
 

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