Shortcut key

H

Hande

Hi everyone,
I created a new menu with the command below:

Application.OnKey key:="^{t}", procedure:="Test"
Application.OnKey key:="^{u}", procedure:="Update"
Set myMenuBar = CommandBars.ActiveMenuBar
Set NewMenu = myMenuBar.Controls.Add
(Type:=msoControlPopup, temporary:=True)
NewMenu.Caption = "Data Send"
Set ctrl1 = NewMenu.Controls.Add(Type:=msoControlButton,
ID:=1)
ctrl1.Caption = "Test"
ctrl1.TooltipText = "Test"
ctrl1.Style = msoButtonCaption
ctrl1.OnAction = "Test"
Set ctrl2 = NewMenu.Controls.Add(Type:=msoControlButton,
ID:=1)
ctrl2.Caption = "Update"
ctrl2.TooltipText = "Update"
ctrl2.Style = msoButtonCaption
ctrl2.OnAction = "Update"

This code opens e main menu called "Data Send" and 2
submenus called "Test" & "Update". With Ctrl+t I
start the "Test" macro and with Ctrl+u "Update" macro. But
my target is to put an underscore to drilldown the
Database menu like under "D" (e.g Alt+F to
drilldown "File" menu) then underscore "t" and "u" for
submenus. Any suggestions???
 
D

David McRitchie

Hi Hande,

Use an ampersand for the underscore that indicates Alt+character to
invoke the menu, or once within a menu the character to invoke
a menu item.

If you want to see an ampersand then double the amersand.

ctrl2.Caption = "&Update && More"
 

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

Top