KMKB0001: HOWTO: Use Word macros to switch font and keyboard at the same time

To create a macro using the Keyman API that switches font and keyboard at the same time:

  1. Download the "Keyman API (VBA Module)” archive from the Tavultesoft Keyman Downloads.
  2. Open this zip file and extract the file KeymanLink.bas to your hard drive.
  3. Start Word, and press Alt+F11 to open the Visual Basic Editor
  4. 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)
  5. Right-click on “Normal” in the Project window, and select Insert->Module
  6. 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
  7. Close the Visual Basic window
  8. Select Tools->Options->Customise, and click the Keyboard button.
  9. Scroll down the list to Macros, and you will see your macros on the right hand list.
  10. 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.
  11. Select Close, Close again. When you close Word, you will be prompted to save “”. Make sure you answer Yes to save your macros.

Applies to:

  • Keyman 6.0
  • Keyman 6.2 Home Use Edition
  • Keyman 6.2 Standard Edition
  • Keyman 6.2 Corporate Edition 10 seat pack 1 yr

KB article KMKB0001 created on 24 May 2006

Browse all knowledge base articles