test if workbook is open?


Posted by RoB on October 09, 2001 9:08 PM

How would i test to see if another workbook is open?

I want to do this in an If statement in a macro.

any ideas? thanks

Posted by Osvaldo Ardiles on October 10, 2001 1:45 AM

There are a few ways to do this. Here's one :-

On Error Resume Next
Workbooks("Book1.xls").Activate
If Err <> 0 Then
MsgBox "Book1.xls is not open."
Else
MsgBox "Book1.xls is open."
End If
On Error GoTo 0




Posted by RoB on October 10, 2001 6:45 PM

thanks!