GetOpenFilename() errors

A

Antnonio Castro

When I use "s = application.GetOpenFilename()" I have two options: a) s =
False (boolean) because I canceled the function; b) s = the selected file (no
boolean).

When I use Y = ubound(s), Excel displays a 13 error, if s = False.

When I use a "if s = False then.." statement, Excel displays a 13 error if s
= the selected file.

I had tried the "on error resume next" instruction but it does not
function.. How can I deal with this situation?
 
R

rylo

Hi

Try something like


Code
-------------------
Sub ddd()
Dim GetFileName
GetFileName = Application.GetOpenFilename()
If GetFileName <> False Then
MsgBox "got a file name " & GetFileName
Else
MsgBox "Cancelled out"
End If

End Su
 
A

Antnonio Castro

rylo said:
Hi

Try something like


Code:
--------------------
Sub ddd()
Dim GetFileName
GetFileName = Application.GetOpenFilename()
If GetFileName <> False Then
MsgBox "got a file name " & GetFileName
Else
MsgBox "Cancelled out"
End If

End Sub
--------------------


rylo


--
rylo
------------------------------------------------------------------------
rylo's Profile: http://www.thecodecage.com/forumz/member.php?userid=28
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=28929

Thank you Rylo, the key was the "Dim GetFileName"
Antonio
 
Top