Application.KeysBoundTo プロパティ (Word)

指定された項目に割り当てられているすべてのキーの組み合わせを表す KeysBoundTo オブジェクトを返します。

構文

expression. KeysBoundTo( _KeyCategory_ , _Command_ , _CommandParameter_ )

expressionApplication オブジェクトを 表す変数。 オプション。

パラメーター

名前 必須 / オプション データ型 説明
KeyCategory 必須 WdKeyCategory キーの組み合わせの分類を指定します。
Command 必須 String コマンドの名前を指定します。
CommandParameter 省略可能 バリアント型 (Variant) 追加テキストは、存在する場合、コマンドで指定されたコマンドの必要です。 詳細については、 KeyBindings オブジェクトの Add メソッドの「解説」セクションを参照してください。

次の使用例は、作業中の文書に添付されているテンプレートの FileOpen コマンドに割り当てられているすべてのキーの組み合わせを表示します。

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

次の使用例は、標準テンプレートの Macro1 からすべてのキーの割り当てを削除します。

Dim aKey As KeyBinding 
 
CustomizationContext = NormalTemplate 
For Each aKey In _ 
 KeysBoundTo(KeyCategory:=wdKeyCategoryMacro, _ 
 Command:="Macro1") 
 aKey.Disable 
Next aKey

関連項目

Application オブジェクト

サポートとフィードバック

Office VBA またはこの説明書に関するご質問やフィードバックがありますか? サポートの受け方およびフィードバックをお寄せいただく方法のガイダンスについては、Office VBA のサポートおよびフィードバックを参照してください。