Share via


Global.GetSpellingSuggestions Method

Word Developer Reference

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

Syntax

expression.GetSpellingSuggestions(Word, CustomDictionary, IgnoreUppercase, MainDictionary, SuggestionMode, CustomDictionary2, CustomDictionary3, CustomDictionary4, CustomDictionary5, CustomDictionary6, CustomDictionary7, CustomDictionary8, CustomDictionary9, CustomDictionary10)

expression   Required. A variable that represents a Global object.

Parameters

Name Required/Optional Data Type Description
Word Required String The word whose spelling is to be checked.
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.
SuggestionMode Optional Variant Specifies the way Word makes spelling suggestions. Can be one of the following WdSpellingWordType constants: wdAnagram, wdSpellword, orwdWildcard. The default value is WdSpellword.

Remarks

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

Example

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.

Visual Basic for Applications
  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

See Also