SynonymList Property

Microsoft Word Visual Basic

expression.SynonymList(Meaning)

expression    Required. An expression that returns a SynonymInfo object.

Meaning    Required Variant. The meaning as a string or an index number in the array of possible meanings.

Example

This example returns a list of synonyms for the word "big," using the meaning "generous" in U.S. English.

Slist = SynonymInfo(Word:="big", LanguageID:=wdEnglishUS) _
    .SynonymList(Meaning:="generous")
For i = 1 To UBound(Slist)
    Msgbox Slist(i)
Next i
		

This example returns a list of synonyms for the second meaning of the selected word or phrase and displays these synonyms in the Immediate window of the Visual Basic editor. If there's no second meaning or if there are no synonyms, this is stated in a message box.

Set mySi = Selection.Range.SynonymInfo
If mySi.MeaningCount >= 2 Then
    synList = mySi.SynonymList(Meaning:=2)
        For i = 1 To UBound(synList)
            Debug.Print synList(i)
        Next i
Else
    MsgBox "There is no second meaning for this word or phrase."
End If