Disabling Spelling and Grammar check in MS Word with AutoHotkey

Microsoft WordI’ve been shoving AutoHotkey code into MS Word a lot lately and got tired of going through all the steps to disable the spell check and grammar checker each time. I tried looking for a button inside MS Word to add to my toolbar but I couldn’t find a button to apply the settings (or to get me to the Proofing page) so I decided to write it in AutoHotkey. Here’s the video explaining how I got the code and the hiccups I had along the way.

Disabling Spelling and Grammar check in MS Word with AutoHotkey

Disabling Spelling and Grammar check in MS Word with AutoHotkey

doc:=ComObjActive("Word.Application") ;this would activate an open one
doc.Application.ScreenUpdating := False
doc.Options.CheckGrammarAsYouType :=True
doc.ActiveDocument.ShowSpellingErrors := False
doc.ActiveDocument.ShowGrammaticalErrors := False
doc.Application.ScreenUpdating := True ;Update the screen

Open multiple files in MS Word and change font type of all text to Calibri

Working with MS Word is excellent when you have AutoHotkey & COM!

Someone on the Facebook AutoHotkey group gave the following requirements

  1. Open file one
  2. open document Word
  3. CTRL+A
  4. change font to Calibri
  5. save file in another file

Here is the code wrote to open multiple files in MS Word and change the font type of all text.  COM Rocks!

Wd:=ComObjCreate("Word.Application") ;this would activate an open one
WD.Visible:=0 ;This is fun to watch, but it will be much, much faster if you set this to zero and have it running w/o being visible

;********************Get list of files***********************************
FileSelectFile,Files,m,%A_ScriptDir%,,Text Documents (*.docx; *.doc)
;*********Use For loop over Var going line by line*********************
MsgBox % Files
for i, File in Loopobj:=StrSplit(Files,"`n","`r`n") { ;Parse Var on each new line
    If (I=1){
      Path:=File "\"
    Menu , tray, tip, % round((i-1)/(Loopobj.maxindex()-1)*100) "% done. " i-1 " of " Loopobj.maxindex()-1 
    WD.Documents.Open(Path File, 0, 1, 0)
    WD.Selection.WholeStory ;Select all text
    WD.Selection.font.Name:="Calibri" ;Change the selected text to the font you want
    newFile:=Path File "_Calibri.docx" ;Add _Calibri to the name (note this will overwrite other files)
WD.Quit() ;Make sure you quit Word when it is done
MsgBox Done!

Here’s a walk-through video open multiple files in MS Word