HOWTO: Use Word macros to switch font and keyboard at the same time
NOTE: This archived documentation has not been updated recently and may contain information that is no longer relevant
Steps
To create a macro using the Keyman API that switches font and keyboard at the same time:
- Download Keyman API (VBA Module) zip archive.
- Open this zip file and extract the file KeymanLink.bas to your hard drive.
- Start Word, and press Alt+F11 to open the Visual Basic Editor
- Right-click on “Normal” and select “Import File”, and choose KeymanLink.bas where you saved it on your hard disk. (After this you can delete KeymanLink.bas again as a copy will be stored in Word separately)
- Right-click on “Normal” in the Project window, and select Insert->Module
- Copy and paste the following code, changing the keyboard and font names as appropriate:
Sub ActivateGreek()
SelectKeymanKeyboard "Greek"
Selection.Font.Name = "MyGreekFont"
End Sub
Sub ActivateHebrew()
SelectKeymanKeyboard "Hebrew"
Selection.Font.Name = "MyHebrewFont"
End Sub
Sub ActivateEnglish()
SelectKeymanKeyboard "", False
Selection.Font.Name = "Times New Roman"
End Sub
- Close the Visual Basic window
- Select Tools->Options->Customise, and click the Keyboard button.
- Scroll down the list to Macros, and you will see your macros on the right hand list.
- Select each macro in turn, click in the “Press new Shortcut Key” window, and press the hotkey to run that macro, then click Assign to use that hotkey. You will want to be careful not to override a hotkey you use normally for other actions.
- Select Close, Close again. When you close Word, you will be prompted to save “normal.dot”. Make sure you answer Yes to save your macros.
Applies to:
- Keyman 6.0
- Keyman 6.2