View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Robin Hammond[_2_] Robin Hammond[_2_] is offline
external usenet poster
 
Posts: 575
Default 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! ; -)