ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to add shortcut to custom menu entry? (https://www.excelbanter.com/excel-programming/362274-how-add-shortcut-custom-menu-entry.html)

Benjamin

How to add shortcut to custom menu entry?
 
I have a piece of VBA code that does the following: It adds to the Worksheet
Menu Bar a control of the type msoControlPopup (i.e. a new menu), and then it
adds to this new control a control of the type msoControlButton (i.e. a new
menu item).

With

Caption = "&New menu point"

I only have to press "N" once the menu is open. To add a direct shortcut, I
wrote

Application.OnKey "+^{N}", "ShowForm"

so I can execute ShowForm by pressing Ctrl+Shift+N. I'd like to have this
displayed next to the menu item, like e.g. in the File menu where it says
"Ctrl+N" next to the "New..." item. How can this be done? I didn't find a
property or anything to do the job.

Thanks in advance,

Benjamin

Benjamin

How to add shortcut to custom menu entry?
 
Never mind, I found a solution: If an OnAction macro is attached, there is a
property ShortcutText that does exactly what I was looking for. I should add
to my defence that help isn't installed on this system yet and I have to wait
for the admin to do so ;-)

"Benjamin" wrote:

I have a piece of VBA code that does the following: It adds to the Worksheet
Menu Bar a control of the type msoControlPopup (i.e. a new menu), and then it
adds to this new control a control of the type msoControlButton (i.e. a new
menu item).

With

Caption = "&New menu point"

I only have to press "N" once the menu is open. To add a direct shortcut, I
wrote

Application.OnKey "+^{N}", "ShowForm"

so I can execute ShowForm by pressing Ctrl+Shift+N. I'd like to have this
displayed next to the menu item, like e.g. in the File menu where it says
"Ctrl+N" next to the "New..." item. How can this be done? I didn't find a
property or anything to do the job.

Thanks in advance,

Benjamin



All times are GMT +1. The time now is 08:50 PM.

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