ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Error handler (https://www.excelbanter.com/excel-discussion-misc-queries/256018-error-handler.html)

linto

Error handler
 
I used the following code to open a file.
2 users at 2 different sites have different path to the same excel file.
i used an error handler to overcome this. but it seems not working
a run time error 1004 appears when it tries to open the file from the first
path and in fact the correct path is the secon one

Workbooks.Open FileName:= _
"I:\_Other_Site\DIESE HARNESS OFFSHORING\00 HARNESS DESIGN
ROUTING\02 Work Request Generator\Harness Routing WR template vE.xls" _
, UpdateLinks:=0
On Error Resume Next
Workbooks.Open FileName:= _
"I:\_My_Site\DIESE HARNESS OFFSHORING\00 HARNESS DESIGN ROUTING\02
Work Request Generator\Harness Routing WR template vE.xls" _
, UpdateLinks:=0
On Error Resume Next

Homey

Error handler
 
you must set error handler before error not after.

"linto" wrote in message
...
|I used the following code to open a file.
| 2 users at 2 different sites have different path to the same excel file.
| i used an error handler to overcome this. but it seems not working
| a run time error 1004 appears when it tries to open the file from the
first
| path and in fact the correct path is the secon one
|
| Workbooks.Open FileName:= _
| "I:\_Other_Site\DIESE HARNESS OFFSHORING\00 HARNESS DESIGN
| ROUTING\02 Work Request Generator\Harness Routing WR template vE.xls" _
| , UpdateLinks:=0
| On Error Resume Next
| Workbooks.Open FileName:= _
| "I:\_My_Site\DIESE HARNESS OFFSHORING\00 HARNESS DESIGN ROUTING\02
| Work Request Generator\Harness Routing WR template vE.xls" _
| , UpdateLinks:=0
| On Error Resume Next



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

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