Keyboard Support

Contact and Search

Keyman.com Homepage

Header bottom

Keyman.com

Index

On this page

Next article >


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:

  1. Download Keyman API (VBA Module) zip archive.
  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
  1. Close the Visual Basic window
  2. Select Tools->Options->Customise, and click the Keyboard button.
  3. Scroll down the list to Macros, and you will see your macros on the right hand list.
  4. 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.
  5. 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