다음을 통해 공유


SynonymInfo.Word Property (Word)

Returns the word or phrase that was looked up by the thesaurus. Read-only String.

Syntax

expression .Word

expression An expression that returns a SynonymInfo object.

Remarks

The thesaurus will sometimes look up a shortened version of the string or range used to return the SynonymInfo object. The Word property allows you to see the exact string that was used.

Example

This example returns a list of synonyms for the first meaning of the third word in the active document.

Sub Syn() 
 Dim mySynObj As Object 
 Dim SList As Variant 
 Dim i As Variant 
 
 Set mySynObj = ActiveDocument.Words(3).SynonymInfo 
 SList = mySynObj.SynonymList(1) 
 For i = 1 To UBound(SList) 
 MsgBox "A synonym for " & mySynObj.Word _ 
 & " is " & SList(i) 
 Next i 
End Sub

This example checks to make sure that the word or phrase that was looked up isn't empty. If it is not, the example returns a list of synonyms for the first meaning of the word or phrase.

Sub SelectWord() 
 Dim mySynObj As Object 
 Dim SList As Variant 
 Dim i As Variant 
 
 Set mySynObj = Selection.Range.SynonymInfo 
 If mySynObj.Word = "" Then 
 MsgBox "Please select a word or phrase" 
 Else 
 SList = mySynObj.SynonymList(1) 
 For i = 1 To UBound(SList) 
 MsgBox "A synonym for " & mySynObj.Word _ 
 & " is " & SList(i) 
 Next i 
 End If 
End Sub 

See Also

Concepts

SynonymInfo Object

SynonymInfo Object Members