Most of us correct misspelled words and grammar as we type or we use spell check before we print or distribute the document. Word’s spell check isn’t a substitute for a thorough proofreading, but it certainly helps - unless you want to highlight all of the misspelled words or create a list of them. Those are tasks, spell check can’t do for you, but a macro can.
The following macro highlights misspelled words and copies those words to a new document:
'Highlight all misspelled words.
'Copy all misspelled words to new document.
Dim rng As Range
Dim docSourse As Document
Dim docNew As Document
Set docSource = ActiveDocument
Set docNew = Documents.Add
For Each rng In docSource.SpellingErrors
rng.Font.Color = wdColorRed
rng.Font.Bold = True
docNew.Range.InsertAfter rng.Text & vbCR
In this case, the macro uses red and bold to make each misspelled word easy to find. You can customize the two rng.Font statements in the For loop to suit your needs. The macro won’t save the new document with the list of misspelled words, but you can add that functionality if you need it.
To add the macro to your document, press [Alt]+[F11] to launch the Visual Basic Editor (VBE). Insert a module if necessary by choosing Module from the Insert menu. Then, add the above code into the module and save the module. (Don’t try to copy and paste from this page, it won’t work. Type the code or download the module.) As is, the macro evaluates the entire document; if you select a range, the macro will ignore it.
There are a number of ways to run the macro. For now, click the Developer tab and then click Macros in the Code group. Select HighlightSpellErrors and click Run. If you use this macro a lot or if you don’t have access to the developer tab, add the macro to the Quick Access Toolbar (QAT). After running the macro, you will find any misspelled words highly visible in red and bold. In addition, you’ll have a new (unsaved) document, with a list of misspelled words.
This macro does not run a spell check session.
Editor’s note: This macro is presented as a learning tool that you can use as a basis for your own project. It should not be treated as a market-ready application.