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

Macro for Images in MS Word

Status
Not open for further replies.

jhurt

Technical User
Dec 18, 2007
9
US
I recorded the following macro to "insert an image from file" the only problem is that it inserts the same image everytime. I would like it open the image from file dialog box and allow me select the image? Can someone tell me what I am doing wrong. I'm still quite new to macros but I'm trying. Thanks a lot!

Sub InsertImage()
'
' InsertImage Macro
' Macro recorded 12/19/2007 by LAMBERT
'
Selection.InlineShapes.AddPicture FileName:= _
"C:\Documents and Settings\All Users\Documents\My Pictures\Sample Pictures\Blue hills.jpg" _
, LinkToFile:=False, SaveWithDocument:=True
End Sub
 



Check out the Dialogs Collection. Help has a list of the Dialogs, along with the arguments.

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
It puts the same image every time, because that is exactly what you are telling it to do.

Why do you need to do with code?

However, if you actually do, then follow Skip's suggestion. Call a dialog.

faq219-2884

Gerry
My paintings and sculpture
 
What does call a dialog mean? I looked it up in the help file liked Skip suggested but was unable to find anything. I'm missing something, please help!
 




Did you not find Built-in Dialog Box Argument Lists. It will take you till next Christmas to use them all.

Skip,

[glasses] When a diminutive clarvoyant had disappeared from detention, headlines read...
Small Medium at Large[tongue]
 
Code:
Application.Dialogs(wdDialogInsertPicture).Show
displays the Insert Picture dialog.

" I looked it up in the help file liked Skip suggested but was unable to find anything."

Really? Unable to find anything? Ummmm, what did you look up? Try typing in "dialog" into Help. Start with checking out "Built-in Dialog Box Argument Lists"

There is a Help topic titled.....

"Displaying Built-in Word Dialog Boxes"

which is, it seems to me, exactly what you are asking about. And it is there, in Help, just like Skip suggested.

Try again.

faq219-2884

Gerry
My paintings and sculpture
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top