This example checks to see whether the thesaurus contains any synonym suggestions for the word "authorize."
Set myword = SynonymInfo(Word:="authorize", _
LanguageID:=wdEnglishUS)
If myword.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.
Set mySyninfo = Selection.Range.SynonymInfo
If mySyninfo.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