Example The IsBook Open Function

Private Function IsBookOpen(sWkbName) As Boolean

' Check to see if workbook is open

' Note that an add-in workbook does not appear in

' the Workbooks collection, so we need another method.

' However, an add-in can be referenced by name, so we simply

' access its Name property. If an error occurs, then

' the workbook is not open.

Dim sName As String

On Error GoTo WkbNotOpen IsBookOpen = True sName = Workbooks(sWkbName).Name

Exit Function


IsBookOpen = False End Function

0 0

Post a comment