I want to capture the backspace event, just do the backspace's action, then add other action, but I am not sure the backspace's original action:Selection. Delete , -1 ?
Sub AddKeyBinding()
With Application
' \\ Do customization in THIS document
.CustomizationContext = ThisDocument
' \\ Add keybinding to this document Shorcut: Backspace
.KeyBindings.Add KeyCode:=BuildKeyCode(wdKeyBackspace), _
KeyCategory:=wdKeyCategoryCommand, Command:="TestKeybinding"
End With
End Sub
' \\ Test sub for keybinding
Sub TestKeybinding()
Selection.Delete , -1 ' I am not sure how to impl the original command
If Selection.Style = "Some...Style" And Selection.Range.ListFormat.ListString = "" Then
Selection.Style = "DefaultStyle"
End If
End Sub
At last I try use autohotkey to solve this question,some code like down:
It's a little kludgy, but it works: