A have a macro, that I would like to run by pressing two keys of my keyboard simultaneously , for example Alt+Enter, because it is so convenient. Ideally this shortcut would be ?alive? only while I am working with a certain document, on closing the document it should be cancelled, for in other macros I use the same shortcut for different purposes. In Excel I used the OnKey statement for watching keystrokes. Interestingly enough in Word OnKey doesn?t work. Instead there is a much more complex way to assign keystroke combinations to macros. My code is like this:

PHP Code:
Sub hidereveal()
Dim hidrange As Range
CustomizationContext 
ActiveDocument
KeyBindings
.Add KeyCode:=BuildKeyCode(wdKeyAltwdKeyReturn), KeyCategory:=wdKeyCategoryMacro_
Command
:="revrange"
Set hidrange ActiveDocument.Range(Start:=Selection.EndEnd:=ActiveDocument.Range.End)
hidrange.Font.Color RGB(160160164)
ActiveDocument.Range(Start:=0End:=Selection.End).Font.Color wdColorAutomatic
End Sub 

Lines 3 and 4 are relavant to my question. When I run the macro invariably I get a run-time error nr ?5346? and the message: The function assigned to the specified key cannot be modified. I tried different key combinations, or single keys, but could not find any that would not trigger the same run-time error. Can anyone help me with this issue. I have reached the point where I have no more ideas.