ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Disable Addin Menu when file not open (https://www.excelbanter.com/excel-programming/325381-disable-addin-menu-when-file-not-open.html)

ExcelMonkey[_190_]

Disable Addin Menu when file not open
 
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

Ron de Bruin

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





All times are GMT +1. The time now is 12:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com