Application.GetOpenFilename

  • Thread starter Thread starter Dan R.
  • Start date Start date
D

Dan R.

Am I not using this properly? I want to end the program if the user
hits Cancel from the select file dialog box, which it does, but when
the user selects a txt file it gives me a type mismatch error. Doesn't
this method automatically convert it to boolean?

Private inputfile As String

inputfile = Application.GetOpenFilename(fileFilter:="Text Files
(*.txt),*.txt", _
Title:="Select the input file")

If inputfile = False Then
End
Else

' Do Stufff

End If
 
Declare the variable as Variant


Private inputfile As Variant

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Back
Top