AntonymList 属性

       

该属性返回单词或短语的反义词列表。该列表以字符串数组的形式返回。Variant 类型,只读。

expression.AntonymList

expression   必需。该表达式返回一个 SynonymInfo 对象。

说明

AntonymList 属性是 SynonymInfo 对象的一个属性,该对象可以从某一区域或应用程序返回。如果从应用程序中返回该对象,则需指明要查找的单词和使用的语言。如果从某区域中返回该对象,则用该区域中使用的语言来查找该区域。

示例

本示例返回美国英语中单词“big”的反义词列表。

Dim arrayAntonyms As Variant
Dim intLoop As Integer

arrayAntonyms = SynonymInfo(Word:="big", _
    LanguageID:=wdEnglishUS).AntonymList
For intLoop = 1 To UBound(arrayAntonyms)
    MsgBox arrayAntonyms(intLoop)
Next intLoop

本示例返回选定单词或短语的反义词列表,并显示在“Visual Basic 编辑器”的“立即窗口”中。

Dim arrayAntonyms As Variant
Dim intLoop As Integer

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

本示例返回活动文档中第三个单词的反义词列表(如果存在反义词)。

Dim rngTemp As Range
Dim arrayAntonyms As Variant
Dim intLoop As Integer

Set rngTemp = ActiveDocument.Words(3)

arrayAntonyms = rngTemp.SynonymInfo.AntonymList
If UBound(arrayAntonyms) = 0 Then
    MsgBox "There are no antonyms for the third word."
Else
    For intLoop = 1 To UBound(arrayAntonyms)
        MsgBox arrayAntonyms(intLoop)
    Next intLoop
End If