Application.GetOpenFilename
This question actually involves Microsoft Word.....
The following code works in Excel, but it gives a compile
error in Word. Does anyone know why?
'--------------------------------------
Public Function MyFileDlg() As String
' This line fails in Word!
NewFN = Application.GetOpenFilename(FileFilter:="Text Files (*.txt), *.txt",
Title:="Please select a file")
If NewFN = False Then
MyFileDlg = ""
Else
MyFileDlg = NewFN
End If
End Function
'-------------------------
Sub Tester()
Dim str As String
str = MyFileDlg
MsgBox str
End Sub
|