Share via


KeysBoundTo.Context Property

Word Developer Reference

Returns an Object that represents the storage location of the specified key binding. Read-only.

Syntax

expression.Context

expression   A variable that represents a KeysBoundTo object.

Remarks

This property can return a Document, Template, or Application object. Built-in key assignments (for example, CTRL+I for Italic) return the Application object as the context. Any key bindings you add will return a Document or Template object, depending on the customization context in effect when the KeyBinding object was added.

Example

This example displays the name of the document or template where the macro named "Macro1" is stored.

Visual Basic for Applications
  Sub TestContext1()
    Dim kbMacro1 As KeysBoundTo
    
    Set kbMacro1 = KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
        Command:="Macro1")
    MsgBox kbMacro1.Context.Name
End Sub

See Also