GetSpellingSuggestions Method

Applies To

Application object, Global object, Range object.

Description

Syntax 1: Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.

Syntax 2: Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.

Syntax 1

expression.GetSpellingSuggestions(CustomDictionary, IgnoreUppercase,
MainDictionary, SuggestionMode, CustomDictionary2 – CustomDictionary10)

Syntax 2

expression.GetSpellingSuggestions(Word, CustomDictionary, IgnoreUppercase,
MainDictionary, SuggestionMode, CustomDictionary2 – CustomDictionary10)

expression Syntax 1: Required. An expression that returns a Range object.

Syntax 2: Optional. An expression that returns an Application object.

Word Required String. The word whose spelling is to be checked.

CustomDictionary Optional Variant. Either an expression that returns a Dictionary object or the file name of the custom dictionary.

IgnoreUppercase Optional Variant. True to ignore words in all uppercase letters. If this argument is omitted, the current value of the IgnoreUppercase property is used.

MainDictionary Optional Variant. Either an expression that returns a Dictionary object or the file name of the main dictionary. If you don't specify a main dictionary, Word uses the main dictionary that corresponds to the language formatting of Word or of the first word in the range.

SuggestionMode Optional Variant. Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants. The default value is WdSpellword.

Constant

Description

wdSpellword

Word suggests correct spellings for the word or the first word in the specified range.

wdWildcard

Word suggests replacements that match the search criteria for a word that contains the question mark (?) or asterisk (*) wildcard character.

wdAnagram

Word suggests anagrams for the word. Word doesn't suggest anagrams from a custom dictionary.


Note This parameter may be ignored, depending on the dictionary file that's in use.

CustomDictionary2 – CustomDictionary10 Optional Variant. Either an expression that returns a Dictionary object or the file name of an additional custom dictionary. You can specify as many as nine additional dictionaries.

Remarks

If the word is spelled correctly, the Count property of the SpellingSuggestions object returns 0 (zero).

See Also

CheckSpelling method, SpellingErrorType property, SpellingSuggestions collection object.

Example

This example looks for the alternate spelling suggestions for the first word in the selection. If there are suggestions, the example runs a spelling check on the selection.

If Selection.Range.GetSpellingSuggestions.Count = 0 Then
    Msgbox "No suggestions."
Else
    Selection.Range.CheckSpelling
End If
This example looks for the alternate spelling suggestions for the word "blat?nt." Suggestions include replacements for the ? wildcard character. Any suggested spellings are displayed in messages boxes.

Set sugList = GetSpellingSuggestions(Word:="?ook", _
    SuggestionMode:=wdWildcard)
If sugList.Count = 0 Then
    Msgbox "No suggestions."
Else
    For each sug in sugList
        Msgbox sug.Name
    Next sug
End If