Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns a TextRange object that represents the specified subset of text words.
Syntax
expression.Words (Start, Length)
expression A variable that represents a TextRange object.
Parameters
Name | Required/Optional | Data type | Description |
---|---|---|---|
Start | Required | Long | The first word in the returned range. |
Length | Optional | Long | The number of words to be returned. The default is 1. |
Return value
TextRange
Remarks
If Length is omitted, the returned range contains one word.
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.
Example
This example formats as bold the second, third, and fourth words in shape two on page one of the active publication.
Application.ActiveDocument.Pages(1).Shapes(2) _
.TextFrame.TextRange.Words(Start:=2, Length:=3) _
.Font.Bold = True
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.