View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron de Bruin Ron de Bruin is offline
external usenet poster
 
Posts: 11,123
Default Disable Addin Menu when file not open

Hi ExcelMonkey

You can use this to avoid the error

Sub test()
On Error GoTo QuitOpen
ActiveWorkbook.Activate
Userform.Show
Exit Sub
QuitOpen:
MsgBox "There is no file open", , "youradd-in name"
Exit Sub
End Sub


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



"ExcelMonkey" wrote in message ...
I have an addin for Excel. I want to be able to grey out
(enable off) the menu items of the add-in when there is
not excel files open. Currently this is not so and if
the user clicks onto the menu items when a file is not
open, the routine generates an error. How do I grey
these out?

THanks