Is there a workbook open in Excel?

G

Guest

how do you tell in VBA if there is workbook open in excel. That is, when I
launch my xla, I want to check to see if there is at least one workbook open.
If not, I will prompt user to open workbook and exit the xla.

Thanks
 
G

Guest

If it counts personal workbooks then I likely cannot us it unless there is a
way for me to tell that it is a personal workbook. I am only interested in
regular workbooks.

EM
 
R

Ron de Bruin

Loop through the workbooks and check if they are hidden

Dim wb As Workbook
Dim Num As Integer
Num = 0
For Each wb In Application.Workbooks
If wb.Windows(1).Visible Then
Num = Num + 1
End If
Next
MsgBox Num
 

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.

Ask a Question

Top