Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for the first word in the specified range.
expression.GetSpellingSuggestions(CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)
expression Required. An expression that returns one of the above objects.
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, Microsoft Word uses the main dictionary that corresponds to the language formatting 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.
WdSpellingWordType can be one of these WdSpellingWordType constants. |
wdAnagram |
wdSpellword |
wdWildcard |
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.
GetSpellingSuggestions method as it applies to the Application and Global objects.
Returns a SpellingSuggestions collection that represents the words suggested as spelling replacements for a given word.
expression.GetSpellingSuggestions(Word, CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)
expression Required. An expression that returns one of the above objects.
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, Microsoft 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.
WdSpellingWordType can be one of these WdSpellingWordType constants. |
wdAnagram |
wdSpellword |
wdWildcard |
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).
Example
As it applies to the Range object.
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
As it applies to the Global object.
This example looks for the alternate spelling suggestions for the word "?ook." Suggestions include replacements for the ? wildcard character. Any suggested spellings are displayed in message boxes.
Sub DisplaySuggestions()
Dim sugList As SpellingSuggestions
Dim sug As SpellingSuggestion
Dim strSugList As String
Set sugList = GetSpellingSuggestions(Word:="lrok", _
SuggestionMode:=wdSpellword)
If sugList.Count = 0 Then
MsgBox "No suggestions."
Else
For Each sug In sugList
strSugList = strSugList & vbTab & sug.Name & vbLf
Next sug
MsgBox "The suggestions for this word are: " _
& vbLf & strSugList
End If
End Sub