ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Bad File error: Need Help (https://www.excelbanter.com/excel-programming/332487-bad-file-error-need-help.html)

Roberto Carabajal

Bad File error: Need Help
 
Hello:

I am programming in Excel 2000 VBA, and using the dir function:

If dir(MYPATH, vbDirectory) = "" then
......
End If

I am getting "Bad File or Number" error although MYPATH variable have
consistent data.
I would appreciate any suggestion. My best regards.
Roberto

William Benson

Bad File error: Need Help
 
Is MYPATH a folder or a file?

It seems Excel is trying to tell you that you are not pointing to a valid
file or folder (no surprise) ...

Is it a mapped folder? Not sure that should make a difference but it has me
curious.

I'll try to help more (if no one else posts the answer) if you give a few
more details.

Bill




"Roberto Carabajal" wrote in
message ...
Hello:

I am programming in Excel 2000 VBA, and using the dir function:

If dir(MYPATH, vbDirectory) = "" then
.....
End If

I am getting "Bad File or Number" error although MYPATH variable have
consistent data.
I would appreciate any suggestion. My best regards.
Roberto




Roberto Carabajal

Bad File error: Need Help
 
MYPATH contains the name of a folder C:\spl
This folder exists.
There are no quotes in the data.
Roberto



William Benson

Bad File error: Need Help
 
Did you put a break on it and see for sure what the value of MYPATH is
and/or debug.print it to the immediate window? I have tested it and it
should work if the directory exists, unless maybe it is an attribute issue
(like it is a hidden folder) but then it should at least show null.

Sorry I cannot help much more, if you do not get an answer soon, maybe
repost the problem.

"Roberto Carabajal" wrote in
message ...
MYPATH contains the name of a folder C:\spl
This folder exists.
There are no quotes in the data.
Roberto






All times are GMT +1. The time now is 10:07 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com