Excel97 VBA: How can I count open workbooks that are not hidden?
Excel97 VBA: How can I count open workbooks that are not hidden?
(OP)
In a function I'm writing, I need to find the number of open workbooks, but I want to exclude those that are hidden. Please help!
Thanks
Barry
Thanks
Barry
RE: Excel97 VBA: How can I count open workbooks that are not hidden?
As you probably know there is no method to count visible workbooks. However, try this routine and I hope it works
Sub VisibleWorkbooks()
'Count the number of Open Workbooks
vopenworkbooks = Application.Windows.Count
vvisible = 0
'Loop to check is the workbook hidden
For counter = 1 To vopenworkbooks
If Windows(counter).Visible = True Then vvisible = vvisible + 1
Next
MsgBox ("the Number of Workbooks open and not hidden is " & vvisible)
End Sub
Let me know how you get on!!
Regards
Monica
RE: Excel97 VBA: How can I count open workbooks that are not hidden?
Thanks again,
Barry