Menus in an xla

R

renukalondon

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.
 
G

Gord Dibben

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 Tools>Macro>Macros.


Gord Dibben MS Excel MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top