PartOfSpeechList Property

Microsoft Word Visual Basic

PartOfSpeechList Property

       

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.PartOfSpeechList

expression   Required. An expression that returns a SynonymInfo object.

Remarks

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.

Example

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