ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Menus in an xla (https://www.excelbanter.com/excel-programming/376219-menus-xla.html)

[email protected]

Menus in an xla
 
Hi,

I have written some modules and some code to create a customised menu
(all in VBA). When I create my xla I can see my modules, but the code
to create the menu does not run unless I go to 'This Workbook' and
manually run the code. When I do this I can see my menu, but when I
click on it the attached macro cannot be found. Please could you tell
me how to get my menu code, within my xla, to run and how to make my
macro visible. Is there some issues with menus within xla's?

Thank you,

r.

Gord Dibben

Menus in an xla
 
First of all, the code to create the menu should be run from the add-in's
Thisworkbook's Workbook_Open routine

Private Sub Workbook_Open()
your menu code
End Sub

Then deleted when the add-in is closed.

Private Sub Workbook_BeforeClose(Cancel As Boolean)
delete code
End Sub

Second of all, macros in add-ins will not show up in ToolsMacroMacros.


Gord Dibben MS Excel MVP

On 29 Oct 2006 08:20:50 -0800, wrote:

Hi,

I have written some modules and some code to create a customised menu
(all in VBA). When I create my xla I can see my modules, but the code
to create the menu does not run unless I go to 'This Workbook' and
manually run the code. When I do this I can see my menu, but when I
click on it the attached macro cannot be found. Please could you tell
me how to get my menu code, within my xla, to run and how to make my
macro visible. Is there some issues with menus within xla's?

Thank you,

r.




All times are GMT +1. The time now is 07:48 PM.

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