ShortcutKey assigning in VBA

J

Jos Vens

Hi,

is it possible to assign a shortcut key to a menu-item? You can assign the
text with the .ShortcutText but how can you make it work (if you press the
ShortcutText, it should do the job!)

Thanks
Jos Vens
 
D

David McRitchie

Hi Jos,
No, but you can assign a short cut to the macro independently of
creating a menu item so you have what you want. If you are going to
have both you might include the shortcut within the menu item description.
 
J

Jos Vens

Thanks David,

is the OnKey method, the only way to accomplish that in VBA?

Thanks
Jos
 
D

David McRitchie

Hi Jos,
I don't know about the second part, but the first part (pass) for a list of
macros is certainly not needed. See
http://www.mvps.org/dmcritchie/excel/buildtoc.htm#ListFunctionsAndSubs

but I tried putting that list in in place of the first part and the shortcuts were
out of sync. But I did say that it was very suitable for me -- it takes too long.

Wish I could extract the shortcut key directly for the bookname!modulename.macroname
for the List Functions and Subs table.,

and also from when I run through the menus, I should be able to pick up the shortcut
keys but could not. barhopper.htm
 
D

Dave Peterson

Symantics maybe. But you could assign a shortcut key to the macro that's called
when you click the menu item.

Take a look in VBA's help for MacroOptions.

There's a nice example.
 

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