Sub GetImportFileName()
Dim Finfo As String
Dim FilterIndex As Integer
Dim Title As String
Dim FileName As Variant
FInfo = "Text Files (*.txt),*.txt," & _
"Lotus Files (*.prn),*.prn," & _
"Comma Separated Files (*.csv),*.csv," & _
"ASCII Files (*.asc),*.asc," & _
"All Files (*.*),*.*"
' Display *.* by default
FilterIndex = 5
Title = "Select a File to Import"
FileName = Application.GetOpenFilename(FInfo,FilterIndex, Title)
If FileName = False Then
MsgBox "No file was selected."
Else
MsgBox "You selected " & FileName
End If
End Sub
|