AddKeyBinding Method (BindingTables Collection)

Object: BindingTables Collection

Adds a shortcut key assignment to the keybindings collection.

Usage

BindingTables.AddKeyBinding (ByVal KeySequence As String,
ByVal Command As String,
ByVal BindType As Variant,
ByVal KeyType As Variant,
ByVal UserData As Variant) As IKeyBinding

Arguments

KeySequence

A string that represents the shortcut keys combination.

Command

A string that represents the menu command or key-in command assigned to the shortcut keys.

BindType

A BindType constant that defines what command type the shortcut key is assigned to.

KeyType

BindKeyType constant that defines the binding type of the shortcut keys.

UserData

(Optional) Reserved for future use.

Return Values

IKeyBinding. The new KeyBinding Object.

Examples

' Get the document BindingTables object 
Set docBindingTables = Gui.Bindings("Document") 
 
' Assign shortcut keys Alt+F1 to Help->Contents->Automation 
docBindingTables.AddKeyBinding "Alt+F1", "Help->Contents->Automation", BindMenu, BindAccelerator