Set font size in MS Word

with AutoHotkey

by Denis Lamarre
last updated February 3, 2016
difficulty.png Easy

by Denis Lamarre


It is easy with AutoHotkey to set Microsoft Word properties (e.g., font size, font name, font style, font color, line spacing). The following script shows a way to set the font size. After this example (and few other informations), you should be able to set about any Word properties with AutoHotkey commands.


Note: You can trigger the following script with your standard keyboard if you don't have an Enterpad. If so, just replace the line 1 on step 2 with your hotkey definition. The Enterpad hotkeys are useful for efficiency driven professionals who want to avoid the trouble of dealing with too many Windows hotkeys [learn more].


overlay-um-wordfontsize.gifPrepare your overlay.
Choose a free key on the Enterpad for which you want to set the font size. Name it something relevant. This example uses "FONT size 24".


Code installation.
Copy/paste the following script in your AutoHotkey script template (Enterpad.ahk) at the chosen key location.

  IfWinNotActive, ahk_class OpusApp
    MsgBox % "MS Word is not active. No action will be performed."
    oWord := ComObjActive("Word.Application")
    MsgBox % "Unable to execute the shortcut." 
  oWord.Selection.Font.Size := 24
  oWord :=

More Info

You can replace the line 14 (or add below the line 14) in the above script with any of the following commands to set something else than the font size.

Set font name to Arial Black:

oWord.Selection.Font.Name  := "Arial Black"

Set italic font style:

oWord.Selection.Font.Italic := 1

Set bold font style:

oWord.Selection.Font.Bold := 1

Unset bold font style:

oWord.Selection.Font.Bold := 0

Set font color to red:

oWord.Selection.Font.Color := 0xFF0000

Set line spacing to 10.5:

oWord.Selection.ParagraphFormat.LineSpacing := 10.5

Execute a custom MS Word macro with the name Macro1:

  MsgBox % "MS Word macro doesn't exist!"

If you want and don't know how to set something in MS Word; Do it with the Word macro recorder activated and check the resulted macro. That will give you clues on how to do it with AutoHotkey.