Application.FindKey 属性 (Word)

返回 KeyBinding 对象,该对象代表指定的组合键。 只读。

语法

expressionFindKey( _KeyCode_ , _ KeyCode2_ )

表达 选。 返回 Application 对象的表达式。

参数

名称 必需/可选 数据类型 说明
KeyCode 必需 Long 通过使用 WdKey 常量之一指定一个密钥。
KeyCode2 可选 Variant 通过使用 WdKey 常量之一指定第二个键。

备注

使用 BuildKeyCode 方法创建 KeyCodeKeyCode2 参数。

示例

本示例禁用活动文档选用的模板中的 ALT + SHIFT + F12 键组合。 若要返回一个 KeyBinding 对象,该对象包含两个以上的参数,使用 BuildKeyCode 方法,如示例中所示。

CustomizationContext = ActiveDocument.AttachedTemplate 
FindKey(KeyCode:=BuildKeyCode(wdKeyAlt, wdKeyShift, _ 
 wdKeyF12)).Disable

本示例显示 F1 指向的命令。

CustomizationContext = NormalTemplate 
MsgBox FindKey(KeyCode:=wdKeyF1).Command

另请参阅

Application 对象

支持和反馈

有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。