Trapping Workbook OPEN errors

  • Thread starter Thread starter sclark
  • Start date Start date
S

sclark

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! ; -)
 
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
 
Back
Top