Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Im getting an error when running this code on the Set. (I found this code as
a solution on another post, but it won't seem to work.) thedir = CurDir() On Error GoTo notOpen Set xlTest = Workbooks("ThePlayingboard.xls") *** GoTo itsOpenNow notOpen: Workbooks.Open Filename:=theDir & "\" & "ThePlayingboard.xls", UpdateLinks:=0 itsOpenNow: Workbooks("ThePlayingboard.xls").Worksheets("Comba t").Activate At the *** marker, this is the line that gets a "runtime error 9, subscript out of range" which I assume is the Workbooks(sub) its talking about. and this Should happen because the file was not open. I was under the impression that the On Error GoTo label would trap the error and force the execution pointer to jump on past the error. I'm just trying to make sure the file is open, if it is open then Activate, else open it then activate. How do you do that? -- Regards, John |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Error Handling - Check a file isn't already open before overwritin | Excel Discussion (Misc queries) | |||
Error handling with a handling routine | Excel Programming | |||
Excel 2003 Workbooks.Open with CorruptLoad=xlRepairFile fails on Excel 5.0/95 file due to Chart, with Error 1004 Method 'Open' of object 'Workbooks' failed | Excel Programming | |||
Error Handling Open Function or query for missing Files | Excel Programming | |||
error on oXL.Workbooks.Open | Excel Programming |