Next & Previous

Don’t spell check code blocks in Microsoft Word

If you’ve pasted in code with syntax highlighting

Select the affected code block, and go to Review on the menu strip or ribbon. Select Language\Set Proofing Language... and tick Do not check spelling or grammar.

Creating a code block style

If you want to type a code block and don’t need syntax highlighting, you can create a new paragraph style in the styles editor and find your way to the Modify Style window.

Set it to your choice of monospace font, such as Consolas or Courier New, and set the font size to about 10. Set the colour to off-black, like maybe a deep blue.

In the bottom left of Modify Style is a ‘Format’ button. Drop it down and pick Language. Tick Do not check spelling or grammar.

Save the style and apply it to your code block.

Source: Microsoft Office Help - (Spell checker flags text I don’t want it to flag)[]