Checking for Open Workbook
this is a better approach:
Sub Tester11()
Dim wkbk As Workbook
On Error Resume Next
Set wkbk = Workbooks("BigData1.xls")
On Error GoTo 0
If wkbk Is Nothing Then
Set wkbk = Workbooks.Open("C:\Data\BigData1.xls")
End If
wkbk.Activate
End Sub
--
Regards,
Tom Ogilvy
"sbharbour" wrote in message
...
Tom:
This worked great! Thanks! One more question... Is there a way to
turn off the message box tell you that the Worksheet is already open
and just go to the workbook.activate routine???
TIA
sbharbour
On Error Resume Next
Workbooks.Open "C:\Myfolder\MyBook.xls"
On Error Goto 0
Workbooks("MyBook.xls").Activate
--
Regards,
Tom Ogilvy
sbharbour wrote in message
...
I've put a button on a spreadsheet that opens another workbook,
works
fine if the other workbook isn't already open.
What I need to do, is to modify this so that it checks to see if
this
workbook is already open, and if it is pop-up a message box saying
the
workbook is already open, otherwise it can just go ahead and open
the
closed workbook...
TIA for any suggestions.
|