Function WorkbookOpen(WorkbookName As String, _
Optional WorkbookObject As Workbook = Nothing) As Boolean
' Description:Determine if a Workbook is open
' Parameters: WorkbookName Name to find in the Workbooks collection
' WorksheetObject If requested, Workbook will be put here
' Example: If WorkBookOpen("Book1") then ...
' Date Ini Modification
' 7/03/12 JSW Initial Programming
On Error GoTo ErrHandler
WorkbookOpen = False 'Assume not found
Dim Object As Workbook
For Each Object In Application.Workbooks
If Object.Name = WorkbookName Then
WorkbookOpen = True
Set WorkbookObject = Object
Exit For
End If
Next
On Error GoTo ErrHandler
ErrHandler:
If Err.Number <> 0 Then MsgBox _
"WorkbookOpen - Error#" & Err.Number & vbCrLf & _
Err.Description, vbCritical, "Error", Err.HelpFile, Err.HelpContext
On Error GoTo 0
End Function