Checking if other workbooks are open


Posted by Stan on November 12, 2001 12:52 PM

My application does not work properly if other workbooks are are open. How can I determine if other workbooks are open when my application is first loaded?

Thanks - Stan

Posted by faster on November 12, 2001 1:07 PM

this may do it:

Sub TestOpen()
'place this at the start of your code

If Workbooks.Count <> 1 Then
MsgBox "ERROR - CLOSE ALL OPEN WORKBOOKS", vbCritical
Exit Sub
End If

End Sub



Posted by Stan on November 12, 2001 1:22 PM

Thanks faster

If Workbooks.Count <> 1 Then MsgBox "ERROR - CLOSE ALL OPEN WORKBOOKS", vbCritical Exit Sub End If