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 Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I resize a picture in a word document?

Status
Not open for further replies.

fischadler

Programmer
May 31, 2002
258
MT
I am trying to create a new Word document from visual basic and I need to add a picture and then resize it.
Usually when I need to do some process in Word, I record a macro and do the actions to get the code. Although I could create the picture while recording, I could not resize it. Therefore I cannot get the commands from the macro.

Below is the code for adding the picture:

Selection.InlineShapes.AddPicture FileName:="logo.jpg", _
LinkToFile:=False, SaveWithDocument:=True

What is the code for resizing the picture?

Thanks
 
How do I reference which inline shape to apply the dimensions? Here's the code I'm using:

wrdSelection.InlineShapes.AddPicture FileName:=App.Path & "\logo.jpg", LinkToFile:=False, SaveWithDocument:=True
wrdSelection.InlineShapes(0).Width = 100
wrdSelection.InlineShapes(0).Height = 100

I am getting an error reading "The requested member of the collection does not exist". How do I know the collection number of the InlineShape to which I added the picture?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top