Word 2003 VBA spell-checking

User avatar
ChrisGreaves
PlutoniumLounger
Posts: 15641
Joined: 24 Jan 2010, 23:23
Location: brings.slot.perky

Word 2003 VBA spell-checking

Post by ChrisGreaves »

I found some good code at This CNet page, and modified it.
It looks way better than anything I could have written (grin)
For me it is a fast way to assemble a list of potentially-mis-spelled words in a document for a pre-processor.

Code: Select all

Sub ab()
    Dim rngRange As Word.Range
    Set rngRange = ActiveDocument.Range
    Dim SpellCollection As ProofreadingErrors
    Set SpellCollection = rngRange.SpellingErrors
    If SpellCollection.Count > 0 Then
        Dim iword As Integer
        Dim newWord As String
        For iword = 1 To SpellCollection.Count
            If SpellCollection.Item(iword).Text <> "" Then
                newWord = SpellCollection.Item(iword).Text
            Debug.Print newWord
            End If
        Next
    End If
End Sub
He who plants a seed, plants life.