Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi,
i have been struggling with a macro to select a workbook if it is open, and open it if it is closed. the details are as follows. workbook to be opened is S:\QUOTE REGISTER updated ( select sheet year to date )which i can do!!there is a password of babylon if the book is closed, then it needs to be opened and sheet selected. if the book is open, then it needs to be made active and sheet selected. i just cannot seem to do it. Kindest Regards, Nigel |
#2
![]() |
|||
|
|||
![]() On Error Resume Next Set oWb = Workbooks("QUOTE REGISTER .xls") On Error Goto 0 If oWB Is Nothing Then Workbooks.Open filename:="S:\QUOTE REGISTER .xls" Else Workbooks("QUOTE REGISTER .xls").Activate End If Activeworkbook.Worksheets("Sheet1").Activate -- HTH Bob Phillips "Nigel" wrote in message ... Hi, i have been struggling with a macro to select a workbook if it is open, and open it if it is closed. the details are as follows. workbook to be opened is S:\QUOTE REGISTER updated ( select sheet year to date )which i can do!!there is a password of babylon if the book is closed, then it needs to be opened and sheet selected. if the book is open, then it needs to be made active and sheet selected. i just cannot seem to do it. Kindest Regards, Nigel |
#3
![]() |
|||
|
|||
![]()
Hi Bob,
thanks for the prompt response. However this seems to error on the following if oWB = Nothing Then there is an error code of 424 object required. Regards, Nigel "Bob Phillips" wrote: On Error Resume Next Set oWb = Workbooks("QUOTE REGISTER .xls") On Error Goto 0 If oWB Is Nothing Then Workbooks.Open filename:="S:\QUOTE REGISTER .xls" Else Workbooks("QUOTE REGISTER .xls").Activate End If Activeworkbook.Worksheets("Sheet1").Activate -- HTH Bob Phillips "Nigel" wrote in message ... Hi, i have been struggling with a macro to select a workbook if it is open, and open it if it is closed. the details are as follows. workbook to be opened is S:\QUOTE REGISTER updated ( select sheet year to date )which i can do!!there is a password of babylon if the book is closed, then it needs to be opened and sheet selected. if the book is open, then it needs to be made active and sheet selected. i just cannot seem to do it. Kindest Regards, Nigel |
#4
![]() |
|||
|
|||
![]()
Nigel,
Precede this code with Dim oWb As Workbook -- HTH Bob Phillips "Nigel" wrote in message ... Hi Bob, thanks for the prompt response. However this seems to error on the following if oWB = Nothing Then there is an error code of 424 object required. Regards, Nigel "Bob Phillips" wrote: On Error Resume Next Set oWb = Workbooks("QUOTE REGISTER .xls") On Error Goto 0 If oWB Is Nothing Then Workbooks.Open filename:="S:\QUOTE REGISTER .xls" Else Workbooks("QUOTE REGISTER .xls").Activate End If Activeworkbook.Worksheets("Sheet1").Activate -- HTH Bob Phillips "Nigel" wrote in message ... Hi, i have been struggling with a macro to select a workbook if it is open, and open it if it is closed. the details are as follows. workbook to be opened is S:\QUOTE REGISTER updated ( select sheet year to date )which i can do!!there is a password of babylon if the book is closed, then it needs to be opened and sheet selected. if the book is open, then it needs to be made active and sheet selected. i just cannot seem to do it. Kindest Regards, Nigel |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
mag-text in merged cells-automatic row heigh | Excel Worksheet Functions | |||
run macro on workbook open | Excel Discussion (Misc queries) | |||
Subscript & Superscript | Excel Discussion (Misc queries) | |||
Run macro in new workbook | Excel Discussion (Misc queries) | |||
Macro for multiple charts | Excel Worksheet Functions |