View Single Post
  #4  
Old 08-31-2015, 10:39 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,395
Hi cjmccormack,

In my tests, while leaving the default string in place, choosing Cancel does result in an empty string.

Quote:
It seems the FileOpenDialog simply returns a unicode string, and even if the user hits Cancel, if there is some text in that string a value will be returned.
What test did you run that produced the above results?

A great trick I learned from our script guru is to enclose the results in angle braces so you can tell if there really is some non-printing value being returned that would otherwise not be obvious.

I used the following test (in this case, you would not even invoke the "if" side unless the variable is empty, but I thought I might provide this debugging tip anyway):

Code:
filePath = crt.Dialog.FileOpenDialog("Please select a text file", "Open", "c:\temp\New.txt")

if filepath = "" then 
    msgbox "you cancelled" & vbcrlf & vbcrlf & "<" & filepath & ">"
else
    msgbox "your path is: " & filepath
end if
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote