ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assign macro to custom menu (https://www.excelbanter.com/excel-programming/377401-assign-macro-custom-menu.html)

Harley

Assign macro to custom menu
 
I wrote a macro to create a custom menu for a specific workbook. This menu is
not needed for any other workbook and is deleted upon closing. How do I
assign, via code, a macro to run when this button is clicked?

Thank you

Tom Ogilvy

Assign macro to custom menu
 
In the code that creates the menu item, use the onaction property to assign
it to a macro. If you are fuzzy on the code, if after you create the menu,
then turn on the macro recorder and do Tools-customize - leave the dialog
displayed and right click on the bottm and assign a macro. Then drop the
dialog and turn off the macro recorder. Look at the recorded code.

--
Regards,
Tom Ogilvy


"Harley" wrote:

I wrote a macro to create a custom menu for a specific workbook. This menu is
not needed for any other workbook and is deleted upon closing. How do I
assign, via code, a macro to run when this button is clicked?

Thank you


Bob Phillips

Assign macro to custom menu
 
You set the OnAction property of the control to your macro when creating it.

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Harley" wrote in message
...
I wrote a macro to create a custom menu for a specific workbook. This menu

is
not needed for any other workbook and is deleted upon closing. How do I
assign, via code, a macro to run when this button is clicked?

Thank you





All times are GMT +1. The time now is 10:32 AM.

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