Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting width of picture inserted into word doc

Status
Not open for further replies.

emozley

Technical User
Jan 14, 2003
769
0
0
GB
Hi,

I've got a script that builds a table in a word document and inserts a picture into the first cell of each row. It works fine apart from the fact that I'd like to set the width and height of every picture to 50 x 70

The line that inserts the picture is:

Set objShape = objTable.Cell(counter,1).Range.InlineShapes.AddPicture(Photo)

Thanks very much

Ed
 
Did you try this ?
objShape.Height = 70
objShape.Width = 50

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
emozley and PHV

objShape.height = 70 and
objShape.width = 50 does not work the way you would expect it to. What you have to do is acutally use inlineshapes and after you have added the picture you will include the following line.

objShape.Item(1).height = 200
objShape.Item(1).width = 200

I think this will work with what you have already. I am including below the code I used which did not involve a table. Please feel free to use it as you would like.

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection

Set objShape = objDoc.InlineShapes
objShape.AddPicture("c:\bunny.jpg")
objShape.Item(1).height = 200
objShape.Item(2).width = 200


Hope this helps you out.

Mike Walton
Network+ CCENT
Free Tech Articles at
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top