View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Check if Any workbooks are open

Maybe you can just check for an active workbook?

Option Explicit
Sub testme()
If ActiveWorkbook Is Nothing Then
MsgBox "no visible workbook"
Else
MsgBox ActiveWorkbook.Name & " is active!"
End If
End Sub



Kevin R wrote:

How do I check to see if ANY workbooks are open before running a macro? I
know how to check to see a particular workbook is open but I just want to
check to see if a (no specific) workbook is open before continuing the macro,
otherwise display a message if no workbook is open.


--

Dave Peterson