Inserting Object in Excel using VB

I have a command button within a userform I am developing, which will automatically take the user to the Excel Insert Object function

Private Sub CommandButton2_Click()
Application.Dialogs(xlDialogInsertObject).Show
End Sub

What I need to understand is how, using VB script, once the user has selected the file and clicks on OK within the Insert Object function, that the selected file is then 'attached' to a specific cell within the userform.

Also, within the existing CommandButtom script, is there anyway when the Insert Object function opens, to default it to Create From File, Vs Create New as it currently defaults to?

[712 byte] By [LanceClark] at [2008-1-7]
# 1

Here are the list of arguments you can pass

sFile.Show object_class, file_name, link_logical, display_icon_logical, icon_file, icon_number, icon_label

For example to Display as Icon set the following:

Dim sFile As Dialog
Set sFile = Application.Dialogs(xlDialogInsertObject)
sFile.Show , , , True

Cheers

Shasur

Shasur at 2007-10-2 > top of Msdn Tech,Microsoft ISV Community Center Forums,Visual Basic for Applications (VBA)...