'/================================================/
' Function Purpose: Returns TRUE if workbook is open
' Returns FALSE if workbook is NOT open
' syntax of strWkbkName is FULL Name
' example: "D:\Temp\Hello.xls"
' strWkbkName must be a string
'
'/================================================/
Public Function WorkbookIsOpen(strWkbkName As String) As Boolean
Dim blnResult As Boolean
Dim iWorkbooks As Double, x As Double
On Error GoTo err_Function
blnResult = False
'count number of open workbooks
iWorkbooks = Application.Workbooks.Count
If iWorkbooks < 1 Then
GoTo exit_Function
End If
For x = 1 To iWorkbooks
If Application.Workbooks(x).FullName = strWkbkName Then
blnResult = True
End If
Next x
End Function
'/================================================/
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.