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

David McRitchie said:
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.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

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,
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

---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

Jos Vens said:
Thanks David,

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

Thanks
Jos

David McRitchie said:
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.
---
HTH,
David McRitchie, Microsoft MVP - Excel [site changed Nov. 2001]
My Excel Pages: http://www.mvps.org/dmcritchie/excel/excel.htm
Search Page: http://www.mvps.org/dmcritchie/excel/search.htm

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

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