Application.KeysBoundTo property (Word)
Returns a KeysBoundTo object that represents all the key combinations assigned to the specified item.
Syntax
expression. KeysBoundTo
( _KeyCategory_
, _Command_
, _CommandParameter_
)
expression A variable that represents an Application object. Optional.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
KeyCategory | Required | WdKeyCategory | The category of the key combination. |
Command | Required | String | The name of the command. |
CommandParameter | Optional | Variant | Additional text, if any, required for the command specified by Command. For more information, see the "Remarks" section in the Add method for the KeyBindings object. |
Example
This example displays all the key combinations assigned to the FileOpen command in the template attached to the active document.
Dim kbLoop As KeyBinding
Dim strOutput As String
CustomizationContext = ActiveDocument.AttachedTemplate
For Each kbLoop In _
KeysBoundTo(KeyCategory:=wdKeyCategoryCommand, _
Command:="FileOpen")
strOutput = strOutput & kbLoop.KeyString & vbCr
Next kbLoop
MsgBox strOutput
This example removes all key assignments from Macro1 in the Normal template.
Dim aKey As KeyBinding
CustomizationContext = NormalTemplate
For Each aKey In _
KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _
Command:="Macro1")
aKey.Disable
Next aKey
See also
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.
피드백
https://aka.ms/ContentUserFeedback
출시 예정: 2024년 내내 콘텐츠에 대한 피드백 메커니즘으로 GitHub 문제를 단계적으로 폐지하고 이를 새로운 피드백 시스템으로 바꿀 예정입니다. 자세한 내용은 다음을 참조하세요.다음에 대한 사용자 의견 제출 및 보기