PDA

View Full Version : vba to insert object in word doc



montecarlo20
04-07-2014, 09:37 AM
Does anyone have any code to be able to insert an object into a word doc?

I recorded the MAcro, but I want a user to be able to navigate to whereever they want to pick a file instead of having it hard coded.

Any ideas?

Thanks!

macropod
04-07-2014, 07:22 PM
Try:
Application.Dialogs(wdDialogInsertObject).Show

montecarlo20
04-08-2014, 08:37 AM
Try:
Application.Dialogs(wdDialogInsertObject).Show

That works great. How can I get it to the point of where I already have it inserting the object from a file,the display as icon checked so the person will just have to browse for a file.

when I record the macro it only returns the true path of it all and doesnt get me to where I just need a user to be able to now have to take so many steps.

is that possible?
I want this already in the code
LinkToFile:=False, DisplayAsIcon:=True, IconFileName:= _

macropod
04-08-2014, 04:08 PM
You could use:

With Application.Dialogs(wdDialogInsertObject)
.DisplayIcon = 1
.Show
End With
Aside from the dialogue box arguments that Word's VBE reveals, there are more listed at: http://msdn.microsoft.com/en-us/library/ff845471.aspx