Here’s a IsWorkbookOpen function to check if a workbook is open or not. Returns TRUE or FALSE
Public Function IsWorkbookOpen(ByVal wkbkname As String) As Boolean
Dim Wb As Workbook
‘check if its already opened in the Windows collection
For Each Wb In Workbooks
If Wb.Name = wkbkname Then IsWorkbookOpen = True
GoTo exitsub
‘check if its already opened in the Windows collection
For Each Wb In Workbooks
If Wb.Name = wkbkname Then IsWorkbookOpen = True
GoTo exitsub
End If
Next Wb
Next Wb
exitsub:
End Sub
End Sub
Here’s a IsWorksheetOpen function to check if a worksheet is open or not. Returns TRUE or FALSE
Public Function IsWorksheetOpen(ByVal wsname As String) As Boolean
Dim wk As Worksheet
For Each wk In Worksheets
If wk.Name = wsname Then
IsWorksheetOpen = True
GoTo exitsub
End If
Next wk
exitsub:
End Function
Dim wk As Worksheet
For Each wk In Worksheets
If wk.Name = wsname Then
IsWorksheetOpen = True
GoTo exitsub
End If
Next wk
exitsub:
End Function
Related posts:

that worked