top of page

Find keywords quickly by getting a list of spelling errors

If you want help getting a list of last names or other proper nouns which may be keywords in a long text excerpt, you can make use of the below Visual Basic macro which will generate a list of words that MS Word will identify as possible spelling errors.


If you simply plug in the code in a new module in Visual Basic:



. . . the macro will review a Word document:




. . . and output a list of the words which are not in the spell check dictionary:



Thanks to Jay Freedman for posting this macro here. [Copy the text from the post on the Microsoft site, or remove the extra blank lines that result when you paste this code into Visual Basic to make it work.]


Sub ListSpellingErrors()

Dim inDoc As Document

Dim outDoc As Document

Dim er As Range

Set inDoc = ActiveDocument

If ActiveDocument.SpellingErrors.Count > 0 Then

Set outDoc = Documents.Add

outDoc.Sections(1).Headers(wdHeaderFooterPrimary) _

.Range.Text = "Spelling errors in " & inDoc.FullName

Else

MsgBox "There are no spelling errors in this document."

Exit Sub

End If

For Each er In inDoc.SpellingErrors

outDoc.Range.InsertAfter er.Text & vbCr

Next er

' optionally, to sort the output,

' remove the quote mark from the next line

' outDoc.Range.Sort

End Sub





Sean O'Shea has more than 20 years of experience in the litigation support field with major law firms in New York and San Francisco.   He is an ACEDS Certified eDiscovery Specialist and a Relativity Certified Administrator.

The views expressed in this blog are those of the owner and do not reflect the views or opinions of the owner’s employer.

If you have a question or comment about this blog, please make a submission using the form to the right. 

Your details were sent successfully!

© 2015 by Sean O'Shea . Proudly created with Wix.com

bottom of page