Check if workbook is already open, if so close

A

anonymous

Hi,

Trying to write a macro to close and check if a workbook is already open
and
open sub Show afterwards.

If the workbook is ALREADY open, then it must be closed first - and the
workbook must be re-opened - and the Sub Show must run.
_________
If the workbook is NOT open, then it must be opened - and the
Sub
Show must run.


If have tried to do it like below, of course it does not work.
Could one of you Guru's please help me?

*******************************************
Sub Check

If Not ("Book1").Active Then _
Workbooks("Book1").Close SaveChanges:=False
Application.Run ("Book2.xls!Show")

Else Application.Run ("Book2.xls!Show")
End If

End sub
*******************************************



*** Sent via Devdex http://www.devdex.com ***
Don't just participate in USENET...get rewarded for it!
 
Top