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?
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
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.