Macro for redirecting keyboard in Word
Macro for redirecting keyboard in Word
(OP)
Hi everybody,
Is there any way to change the input character in Word?
I need to redirect the keyboard so that every time I press the 'D' key on keyboard, the 'Shift + X' character typed in Word document.
Any macro?
Any prompt reply would be highly appreciated.
:)
Farzad
Is there any way to change the input character in Word?
I need to redirect the keyboard so that every time I press the 'D' key on keyboard, the 'Shift + X' character typed in Word document.
Any macro?
Any prompt reply would be highly appreciated.
:)
Farzad
RE: Macro for redirecting keyboard in Word
Sub Macro1()
CustomizationContext = ActiveDocument
aCode = BuildKeyCode(wdKeyD)
KeyBindings.Add KeyCode:=aCode,_
KeyCategory:=wdKeyCategoryMacro, _
Command:="Macro2"
End Sub
Use the following to type "X" in the document:
Sub Macro2()
Selection.TypeText Text:="X"
End Sub
Run Macro1 once to initialize the KeyBindings. Now everytime you press key "D" it types "X" in the document.
Note that you could store the binding in the normal template by replacing:
CustomizationContext = ActiveDocument
with:
CustomizationContext = NormalTemplate
Paul
RE: Macro for redirecting keyboard in Word
Your answer is perfect.
Thanks a lot.
The macro works as I mentioned, but as I use the arabic fonts, there is some problems to insert arabic characters in VBA editor.
:)
Farzad