Class ProofreadingErrors (Word VBA)

A collection of spelling and grammatical errors for the specified document or range. To use a ProofreadingErrors class variable it first needs to be instantiated, for example


Dim pes as ProofreadingErrors
Set pes = ActiveDocument.SpellingErrors

Count

Returns a Long that represents the number of proofreading errors in the collection.


Dim lngCount As Long
lngCount = ActiveDocument.SpellingErrors.Count

Item

Returns an individual Range object in a collection.

Item (Index)

Index: The individual object to be returned. Can be a Long indicating the ordinal position of the individual object.


Dim rngProofreadingError As Range
Set rngProofreadingError = ActiveDocument.SpellingErrors(Index:=1)

Type

Returns the type of proofreading error. Possible return values are wdGrammaticalError - Grammatical error, wdSpellingError - Spelling error.


Dim wpeType As WdProofreadingErrorType
wpeType = ActiveDocument.SpellingErrors.Type