ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trapping Workbook OPEN errors (https://www.excelbanter.com/excel-programming/288329-trapping-workbook-open-errors.html)

sclark

Trapping Workbook OPEN errors
 
I am having trouble isolating the various error types when
opening workbooks. I wrap the code in ON error stuff,
then open, then check the error. Whether the file exists,
or does NOT exist, the err is 1004. I see elsewhere there
is reference to Error( ) where 53 is one of them and 55 is
the other, but I cannot seem to figure out how to check
these. Right now, I am using the first 5 chars of the
error DESCR and it works, but I don't like that approach.
Help please! ; -)



Robin Hammond[_2_]

Trapping Workbook OPEN errors
 
Why not use the Dir function before you attempt to open the file and if it
returns empty you know the file is not there.

msgbox dir("c:\windows\win.ini") returns win.ini as a string and nothing if
the file doesn't exist.

Robin Hammond
www.enhanceddatasystems.com

"sclark" wrote in message
...
I am having trouble isolating the various error types when
opening workbooks. I wrap the code in ON error stuff,
then open, then check the error. Whether the file exists,
or does NOT exist, the err is 1004. I see elsewhere there
is reference to Error( ) where 53 is one of them and 55 is
the other, but I cannot seem to figure out how to check
these. Right now, I am using the first 5 chars of the
error DESCR and it works, but I don't like that approach.
Help please! ; -)






All times are GMT +1. The time now is 02:40 PM.

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