ProofreadingErrors Collection Object

Multiple objects
Multiple objects

A collection of spelling and grammatical errors for the specified document or range. There is no ProofreadingError object; instead, each item in the ProofreadingErrors collection is a Range object that represents one spelling or grammatical error.

Using the ProofreadingErrors Collection

Use the SpellingErrors or GrammaticalErrors property to return the ProofreadingErrors collection. The following example counts the spelling and grammatical errors in the selection and displays the results in a message box.

Set pr1 = Selection.Range.SpellingErrors
   sc = pr1.Count
Set pr2 = Selection.Range.GrammaticalErrors
   gc = pr2.Count
Msgbox "Spelling errors: " & sc & vbCr _
    & "Grammatical errors: " & gc

Use SpellingErrors(index), where index is the index number, to return a single spelling error (represented by a Range object). The following example finds the second spelling error in the selection and then selects it.

Set myRange = Selection.Range.SpellingErrors(2)

Use GrammarErrors(index), where index is the index number, to return a single grammatical error (represented by a Range object). The following example returns the sentence that contains the first grammatical error in the selection.

Set myRange = Selection.Range.GrammaticalErrors(1)
Msgbox myRange.Text


The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object. If all the words in the document or range are spelled correctly and are grammatically correct, the Count property for the ProofreadingErrors object returns 0 (zero) and the SpellingChecked and GrammarChecked properties return True.

Properties | Application Property | Count Property | Creator Property | Parent Property | Type Property

Methods | Item Method

Parent Objects | Document | Range

Child Objects | Bookmarks | Borders | Cells | Characters | Columns | Comments | Document | Editors | EndnoteOptions | Endnotes | Fields | Find | Font | FootnoteOptions | Footnotes | FormFields | Frames | HTMLDivisions | Hyperlinks | InlineShapes | ListFormat | ListParagraphs | PageSetup | ParagraphFormat | Paragraphs | ProofreadingErrors | Range | ReadabilityStatistics | Revisions | Rows | Sections | Sentences | Shading | ShapeRange | SmartTags | Subdocuments | SynonymInfo | Tables | TextRetrievalMode | Words | XMLNode | XMLNodes

See Also | GrammaticalErrors Property | SpellingErrors Property