Counting Workbooks


Posted by Keith on March 20, 2000 6:59 AM

Can any one help?

I need a Macro that can count how many Workbooks are open and then list them.

Then if possible give a number of how many are open.

This one has been racking my Brains.

I dare say it's easy but can some one point out the obvious.

Thanks,

Keith



Posted by AB on March 21, 2000 5:41 AM

Keith,

You are correct in your assumption.
It's easy.

Listing all open workbooks...

Sub ListWB()
For Each WB In Application.Workbooks
ActiveCell.Offset(n, 0).Value = WB.Name
n = n + 1
Next WB
End Sub

As far as a count of how many are open...

x = Application.Workbooks.Count
msgbox(x)