PDA

View Full Version : Use special characters as hotkey for VBA function



ayn
07-18-2017, 06:18 AM
I am trying to assign key bindings to various VBA functions. The following code works fine for normal characters, but fails when I try to assign a function to special characters, such as German umlauts ("Ü", "Ö"). Is it possible to do that in code?



Option Explicit

Sub Document_New()
With Application
.CustomizationContext = ThisDocument
.KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyP), KeyCategory:=wdKeyCategoryCommand, Command:="Function_p"
.KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyControl, wdKeyAlt, wdKeyC), KeyCategory:=wdKeyCategoryCommand, Command:="Function_c"
End With
End Sub


Thank you!