Words Method

Applies To

TextRange object.

Description

Returns a TextRange object that represents the specified subset of text words. For information about counting or looping through the words in a text range, see the TextRange object.

Syntax

expression.Words(Start, Length)

expression Required. An expression that returns a TextRange object.

Start Optional Long. The first word in the returned range.

Length Optional Long. The number of words to be returned.

Remarks

If both Start and Length are omitted, the returned range starts with the first word and ends with the last paragraph in the specified range.

If Start is specified but Length is omitted, the returned range contains one word.

If Length is specified but Start is omitted, the returned range starts with the first word in the specified range.

If Start is greater than the number of words in the specified text, the returned range starts with the last word in the specified range.

If Length is greater than the number of words from the specified starting word to the end of the text, the returned range contains all those words.

See Also

Characters method, Lines method, Paragraphs method, Runs method, Sentences method.

Example

This example formats as bold the second, third, and fourth words in the first paragraph in shape two on slide one in the active presentation.

Application.ActivePresentation.Slides(1).Shapes(2).TextFrame _
    .TextRange.Paragraphs(1).Words(2, 3).Font.Bold = True