PC Review


Reply
Thread Tools Rate Thread

Application.GetOpenFilename

 
 
Dan R.
Guest
Posts: n/a
 
      11th Apr 2007
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

 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      11th Apr 2007
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)

"Dan R." <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Dan R.
Guest
Posts: n/a
 
      11th Apr 2007
That's right, Thanks Bob.

-- Dan

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Application.GetOpenFileName =?Utf-8?B?Q2hyaXM=?= Microsoft Excel Programming 7 19th Aug 2006 12:37 AM
Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen) Paul Martin Microsoft Excel Programming 3 5th Aug 2005 04:44 PM
Application.GetOpenFilename Nigel Microsoft Excel Programming 0 23rd Mar 2005 03:24 PM
Application.GetOpenFilename Greg Microsoft Excel Programming 3 20th Feb 2005 01:55 AM
Application.GetOpenFilename Philipp Oberleitner Microsoft Excel Programming 2 9th Jul 2004 07:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:33 PM.