Namely, I called the following snippet in a button handler:
TextBox1.Text = Application.GetOpenFilename(\"All files (*.*),*.*\", _
1, \"Open the Raw Data
There is no Application.GetOpenFilename
in Word.
You need to use FileDialog
instead. Here's a quick example:
Private Sub CommandButton1_Click()
Dim s As Variant
Dim Res As Integer
Dim dlgSaveAs As FileDialog
Set dlgSaveAs = Application.FileDialog( _
FileDialogType:=msoFileDialogSaveAs)
Res = dlgSaveAs.Show
If Not Res = 0 Then
For Each s In dlgSaveAs.SelectedItems 'There is only one
MsgBox s
Next
End If
End Sub