Issue 1When you load an Excel add-in (.xlam) or an Excel 97-2003 add-in (.xla), the command bars of the add-in are not displayed automatically. Instead, you must close all workbooks and then restart Excel to display the command bars.
Issue 2When you unload an Excel add-in (.xlam) or an Excel 97-2003 add-in (.xla) or close an Excel macro-enabled workbook (.xlsm) that contains command bars, the command bars of the add-in or the macro-enabled workbook are not removed from all open workbooks.
The following code sample creates menu items by using the CommandBar object:
Application.CommandBars("Worksheet Menu Bar").Controls.Add Type:=msoControlPopup
To work around issue 2, use one of the following methods:
- Replace command bars with a Ribbon (XML) item in the add-in or the macro-enabled workbook. For more information about the Ribbon (XML), go to the following Microsoft website:
- In the Workbook_BeforeClose event of the add-in or the macro-enabled workbook, loop through all open windows, and remove the command bars. The following is a code sample:Note In this code, the placeholder <ToolbarName> represents a command bar name.
For Each wnd In Application.Windows
Id. de artículo: 2761240 - Última revisión: 23 sept. 2015 - Revisión: 1