Application.GetOpenFilename

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
 
B

Bob Phillips

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top