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

Open dialog box in Word

Status
Not open for further replies.

acjeff

Programmer
Aug 10, 2004
148
0
0
US
Hi,

I am writing some Ms Word macros. I need to export data to an Excel worksheet. I need a button to open a dialog box and let users to select the Excel file. How can I create a dialog box in Word macro?

Jeff
 
You can use a built-in dialog, here is a snipit that should get you moving in the right direction.
Code:
With Dialogs.Item(wdDialogFileOpen)
  .Name = "*.xls"
  If .Display = -1 Then
    MsgBox .Name, vbOKOnly, "User selected file:"
  Else
    MsgBox "The cancel button was pressed", vbOKOnly, "Operation canceled by user"
  End If
End With

Hope this helps,
CMP

(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top