Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Menu (CommandBar) if not workbook is opened
A add-in will close when you close Excel.
Can you explain more what you want ? Do you have problems when people use your menu with no workbook open ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... Thanks Ron, merry Christmas by the way. Yes I did. My concern is that the Add-In will remain installed even if not workbook in opened so I'd imagine that it is technically not closed, is it? "Ron de Bruin" wrote: Do you create the menu with VBA code ? You can create the menu in the Open even and close it in the beforeclose event See this example Debra Dalgleish's (Toolbar example from Dave Peterson) http://www.contextures.com/xlToolbar02.html -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... I have a menu from an Add-In, when all workbooks are closed and all the other menus are disabled mine remains enabled. How can I disabled it so if someone clicks it no error message is generated? Just as the built-in ones. Thanks in advance |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Menu (CommandBar) if not workbook is opened
You can add this to your macro if you not want to run the code if there is no
workbook open. If there are a lot of macros you can also build a function to do the test so you only have to add one code line to each macro. On Error GoTo QuitOpen ActiveWorkbook.Activate 'Your macro code Exit Sub QuitOpen: MsgBox "There is no file open", , "YourProgName" Exit Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... A add-in will close when you close Excel. Can you explain more what you want ? Do you have problems when people use your menu with no workbook open ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... Thanks Ron, merry Christmas by the way. Yes I did. My concern is that the Add-In will remain installed even if not workbook in opened so I'd imagine that it is technically not closed, is it? "Ron de Bruin" wrote: Do you create the menu with VBA code ? You can create the menu in the Open even and close it in the beforeclose event See this example Debra Dalgleish's (Toolbar example from Dave Peterson) http://www.contextures.com/xlToolbar02.html -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... I have a menu from an Add-In, when all workbooks are closed and all the other menus are disabled mine remains enabled. How can I disabled it so if someone clicks it no error message is generated? Just as the built-in ones. Thanks in advance |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Disable Menu (CommandBar) if not workbook is opened
It works fine, thank you ron
"Ron de Bruin" wrote: You can add this to your macro if you not want to run the code if there is no workbook open. If there are a lot of macros you can also build a function to do the test so you only have to add one code line to each macro. On Error GoTo QuitOpen ActiveWorkbook.Activate 'Your macro code Exit Sub QuitOpen: MsgBox "There is no file open", , "YourProgName" Exit Sub -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Ron de Bruin" wrote in message ... A add-in will close when you close Excel. Can you explain more what you want ? Do you have problems when people use your menu with no workbook open ? -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... Thanks Ron, merry Christmas by the way. Yes I did. My concern is that the Add-In will remain installed even if not workbook in opened so I'd imagine that it is technically not closed, is it? "Ron de Bruin" wrote: Do you create the menu with VBA code ? You can create the menu in the Open even and close it in the beforeclose event See this example Debra Dalgleish's (Toolbar example from Dave Peterson) http://www.contextures.com/xlToolbar02.html -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "LuisE" wrote in message ... I have a menu from an Add-In, when all workbooks are closed and all the other menus are disabled mine remains enabled. How can I disabled it so if someone clicks it no error message is generated? Just as the built-in ones. Thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Disable menu item when a particular excel file is opened | Excel Programming | |||
Enable/Disable CommandBar Buttons Based on Events | Excel Programming | |||
Disable CommandBar buttons while editing the cell | Excel Programming | |||
Disable Save As just for opened workbook | Excel Programming |