Class SpellingSuggestion (Word VBA)

The class SpellingSuggestion represents a single spelling suggestion for a misspelled word. The SpellingSuggestion object is a member of the SpellingSuggestions collection. The SpellingSuggestions collection includes all the suggestions for a specified word or for the first word in the specified range.


To use a SpellingSuggestion class variable it first needs to be instantiated, for example

Dim ssn as SpellingSuggestion
Set ssn = GetSpellingSuggestions(Index:=1)

The following procedures can be used to set variables of type SpellingSuggestion: SpellingSuggestions.Item, Application.GetSpellingSuggestions and Range.GetSpellingSuggestions

For Each

Here is an example of processing the SpellingSuggestion items in a collection.

Dim strWord As String: strWord = 
Dim ssnGetSpellingSuggestion As SpellingSuggestion
For Each ssnGetSpellingSuggestion In GetSpellingSuggestions(Word:=strWord)
Next ssnGetSpellingSuggestion


Returns the name of the specified object.

Dim strName As String
strName = GetSpellingSuggestions(1).Name


Returns an object that represents the parent object of the specified SpellingSuggestion object.

Dim objParent As Object
Set objParent = GetSpellingSuggestions(1).Parent


Returns a Long that represents the number of spelling suggestions in the collection.

Dim lngCount As Long
lngCount = GetSpellingSuggestions.Count


Returns an individual SpellingSuggestion object in a collection.

Syntax : expression.Item (Index)

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

Dim ssn As SpellingSuggestion
Set ssn = GetSpellingSuggestions(Index:=1)


Returns an object that represents the parent object of the specified SpellingSuggestions object.

Dim objParent As Object
Set objParent = GetSpellingSuggestions.Parent


Returns the spelling error type.

Possible Values are wdSpellingCapitalization - Capitalization error, wdSpellingCorrect - Spelling is correct, wdSpellingNotInDictionary - The word is not in the specified dictionary.

Use the GetSpellingSuggestions method to return a collection of words suggested as spelling replacements. If a word is misspelled, the CheckSpelling method returns True.

Set suggs = ActiveDocument.Content.GetSpellingSuggestions 
If suggs.SpellingErrorType = wdSpellingNotInDictionary Then 
 StatusBar = "Unknown word" 
End If