![Scratch :scratch:](./images/smilies/scratch.gif)
(still using windows 7)
Code: Select all
Function AssignOnekey(strLetter As String, strCommand As String)
' wdKeyShift = 256 = +
' wdKeyControl = 512 = ^
' wdKeyAlt = 1024 = %
Dim lngKeyCode As Long
lngKeyCode = lngGetKeyCodes(strLetter)
' CustomizationContext = ThisDocument
''' KeyBindings.Add KeyCode:=BuildKeyCode(Asc(strLetter), wdKeyControl, wdKeyShift), KeyCategory:=wdKeyCategoryMacro, Command:=strCommand
KeyBindings.Add KeyCode:=lngKeyCode, KeyCategory:=wdKeyCategoryMacro, Command:=strCommand
' Application.CustomizationContext = NormalTemplate
'Sub TESTAssignOnekey()
' Call AssignOnekey("D", "TypeDateConst")
' Call AssignOnekey("T", "TypeTimeConst")
' Call AssignOnekey("Y", "TypeYesterday")
' Call AssignOnekey("8", "ToggleShowAll")
' Call AssignOnekey("4", "TypeTwoWeeks")
'End Sub
End Function