For this you should be using a userform of the type discussed in the article
"How to create a Userform" at:
http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm
Then you need a button on the form with a caption something like "Browse for
Image" and for the Click() event for that form, you would use the following
code:
With Dialogs(wdDialogInsertPicture)
If .Display Then
'Populate the txtOrgChartPath control with the selected filename
txtOrgChartPath = WordBasic.FilenameInfo$(.Name, 1)
cmdInsertOrgChart.Enabled = True
End If
End With
In the form from which I grabbed this piece of code, the user was browsing
for a file that contained and organization chart and there was a textbox
(txtOrgChartPath) on the form that was populated with the path and filename
of the file that was selected by the user when the InsertPicture dialog was
displayed. The code also activated a button that when clicked, inserted the
organisation chart into the document using the following code:
Private Sub cmdInsertOrgChart_Click()
' Check that a file has been selected
If InStr(txtOrgChartPath, ":") = 0 Then
MsgBox "You must select a file for the Organization Chart."
Exit Sub
End If
'Insert organization chart into Quality Manual
Set myDoc = Documents.Open(PathofSystemFiles & "\Quality
Manual\Quality_Manual.doc")
If myDoc.Bookmarks.Exists("Org_Chart") = True Then
'Clear existing organization chart
myDoc.Bookmarks("Org_Chart").Range.Tables(1).Cell(1, 2).Range.Delete
'Insert new organization chart
myDoc.Bookmarks("Org_Chart").Range.Tables(1).Cell(1,
2).Range.InlineShapes.AddPicture Filename:=txtOrgChartPath
'Save and close the document
myDoc.Save
End If
myDoc.Close
End Sub
You will need to modify this for your situation, but it should show you the
necessary syntax to use.
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP