SynonymInfo.PartOfSpeechList property (Word)
Returns a list of the parts of speech corresponding to the meanings found for the word or phrase looked up in the thesaurus. The list is returned as an array of integers. Read-only Variant.
expression An expression that returns a 'SynonymInfo' object.
The list of the parts of speech is returned as an array consisting of the following WdPartOfSpeech constants: wdAdjective, wdAdverb, wdConjunction, wdIdiom, wdInterjection, wdNoun, wdOther, wdPreposition, wdPronoun, and wdVerb. The array elements are ordered to correspond to the elements returned by the MeaningList property.
This example checks to see whether the thesaurus found any meanings for the selection. If so, the meanings and their corresponding parts of speech are displayed in a series of message boxes.
Set mySynInfo = Selection.Range.SynonymInfo If mySynInfo.MeaningCount <> 0 Then myList = mySynInfo.MeaningList myPos = mySynInfo.PartOfSpeechList For i = 1 To UBound(myPos) Select Case myPos(i) Case wdAdjective pos = "adjective" Case wdNoun pos = "noun" Case wdAdverb pos = "adverb" Case wdVerb pos = "verb" Case Else pos = "other" End Select MsgBox myList(i) & " found as " & pos Next i Else MsgBox "There were no meanings found." End If
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.