View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Simon Shaw Simon Shaw is offline
external usenet poster
 
Posts: 60
Default no workbooks open

thanks,

How do I get it to execute when a different workbook is closed?


"Ron de Bruin" wrote:

Note: that this also count the personal.xls workbook that is 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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"ben" (remove this if mailing direct) wrote in message
...
simon
if workbooks.count = 0 then

'disable buttons
end if
--
When you lose your mind, you free your life.


"Simon Shaw" wrote:

When no workbooks are open, most toolbuttons and menu options in Excel are
disabled.

I have a menu and toolbar created by an add-in I built. How can I detect in
my addin that no workbooks are open so I can set the toolbuttons and menu
options to disabled?