AntonymList Property Example

This example returns a list of antonyms for the word "big" in U.S. English.

Alist = SynonymInfo(Word:="big", _
    LanguageID:=wdEnglishUS).AntonymList
For i = 1 To UBound(Alist)
    Msgbox Alist(i)
Next i

This example returns a list of antonyms for the word or phrase in the selection and displays them in the Immediate window in the Visual Basic Editor.

antList = Selection.Range.SynonymInfo.AntonymList
If UBound(antList) <> 0 Then
    For i = 1 To UBound(antList)
        Debug.Print antList(i) & Str(i)
    Next i
Else
    Msgbox "No antonyms were found."
End If

This example returns a list of antonyms for the third word in the active document, if there are any.

Set myRange = ActiveDocument.Words(3)
myalist = myRange.SynonymInfo.AntonymList
If Ubound(myalist) = 0 Then
    MsgBox "There are no antonyms for the third word."
Else
    For i = 1 To UBound(myalist)
        Msgbox myalist(i)
    Next I
End If