Application.KeyBindings property (Word)
Returns a KeyBindings collection that represents customized key assignments, which include a key code, a key category, and a command.
Syntax
expression. KeyBindings
expression A variable that represents an Application object.
Example
This example assigns the CTRL+ALT+W key combination to the FileClose command. This keyboard customization is saved in the Normal template.
CustomizationContext = NormalTemplate
KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, _
wdKeyW), KeyCategory:=wdKeyCategoryCommand, _
Command:="FileClose"
This example inserts the command name and key combination string for each item in the KeyBindings collection.
Dim kbLoop As KeyBinding
CustomizationContext = NormalTemplate
For Each kbLoop In KeyBindings
Selection.InsertAfter kbLoop.Command & vbTab _
& kbLoop.KeyString & vbCr
Selection.Collapse Direction:=wdCollapseEnd
Next kbLoop
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.
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk