SynonymInfo object: True if the thesaurus finds synonyms, antonyms, related words, or related expressions for the word or phrase. Read-only Boolean.
Find object: True if the search produces a match. Read-only Boolean.
This example checks to see whether the thesaurus contains any synonym suggestions for the word "authorize."
Dim siTemp As SynonymInfo Set siTemp = SynonymInfo(Word:="authorize", _ LanguageID:=wdEnglishUS) If siTemp.Found = True Then Msgbox "The thesaurus has suggestions." Else Msgbox "The thesaurus has no suggestions." End If
This example checks to see whether the thesaurus contains any synonym suggestions for the selection. If it does, the example displays the Thesaurus dialog box with the synonyms listed.
Dim siTemp As SynonymInfo Set siTemp = Selection.Range.SynonymInfo If siTemp.Found = True Then Selection.Range.CheckSynonyms Else Msgbox "The thesaurus has no suggestions." End If
This example removes formatting from the find criteria before searching the selection. If the word "Hello" with bold formatting is found, the entire paragraph is selected and copied to the Clipboard.
With Selection.Find .ClearFormatting .Font.Bold = True .Execute FindText:="Hello", Format:=True, Forward:=True If .Found = True Then .Parent.Expand Unit:=wdParagraph .Parent.Copy End If End With