I thought the DIR function would return a null string if it could not find the file or directory. In my case, it returns "bad file name or number."
How do I catch this error? I tried iserr(dir(....)) and iserror(dir(....)). Both still returned "bad file name or number".
My code looks like this:
if dir(....) <> "" then 'found the file
do something
If I can catch the error, I can modify the code to suit my need. Thanks.
How do I catch this error? I tried iserr(dir(....)) and iserror(dir(....)). Both still returned "bad file name or number".
My code looks like this:
if dir(....) <> "" then 'found the file
do something
If I can catch the error, I can modify the code to suit my need. Thanks.