select workbook macro

N

Nigel

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
 
B

Bob Phillips

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
 
N

Nigel

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
 
Top