Home > Code Library > SmartMenuXP > KeyCode

Last Update 01 Nov 2001









SmartMenuXP Reference

KeyCode Property

Returns or sets the key code of a menu item's shortcut.


object.KeyCode(menuID) [= value]

The KeyCode property syntax has these parts:

Part Description
object An object expression that evaluates to a SmartMenuList object.
menuID A numeric expression that evaluates to a menu item.
value A numeric expression that evaluates to the key code of the shortcut.


Menu items can have a shortcut which is a combination of a ShiftConstant flag and a KeyCodeConstant value. Shortcuts are displayed to the right of the menu window and the menu item can be selected by just typing its shortcut. An example of a shortcut is ALT+Q for the menu item "Exit".

    .Add "keyFile", , , "E&xit", , vbAltMask , vbKeyQ

The key code for the example above would be vbKeyQ.

Copyright © 2001, Andrés Pons (andres@vbsmart.com). All rights reserved.