Application.BuildKeyCode メソッド (Word)

指定されたキーの組み合わせの固有の番号を返します。

構文

BuildKeyCode (Arg1Arg2Arg3Arg4)

expressionApplication オブジェクトを 表す変数。

パラメーター

名前 必須 / オプション データ型 説明
Arg1 必須 WdKey Wdkey クラス の定数のいずれかを使用してキーを指定します。
Arg2 - Arg4 省略可能 WdKey Wdkey クラス の定数のいずれかを使用してキーを指定します。

This example assigns the ALT + F1 key combination to the Organizer command.

CustomizationContext = NormalTemplate 
KeyBindings.Add KeyCode:=BuildKeyCode(Arg1:=wdKeyAlt, _ 
 Arg2:=wdKeyF1), KeyCategory:=wdKeyCategoryCommand, _ 
 Command:="Organizer"

This example removes the ALT+F1 key assignment from the Normal template.

CustomizationContext = NormalTemplate 
FindKey(BuildKeyCode(Arg1:=wdKeyAlt, Arg2:=wdKeyF1)).Clear

This example displays the command assigned to the F1 key.

CustomizationContext = NormalTemplate 
MsgBox FindKey(BuildKeyCode(Arg1:=wdKeyF1)).Command

関連項目

Application オブジェクト

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

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