Selection.Extend Method
Word Developer Reference |
Turns on extend mode, or if extend mode is already on, extends the selection to the next larger unit of text.
Syntax
expression.Extend(Character)
expression Required. A variable that represents a Selection object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Character | Optional | Variant | The character through which the selection is extended. This argument is case sensitive and must evaluate to a String or an error occurs. Also, if the value of this argument is longer than a single character, Microsoft Word ignores the command entirely. |
Remarks
Using this method sets the ExtendMode property to True if it is not already.
The progression of selected units of text is as follows: word, sentence, paragraph, section, entire document. If Character is specified, this method extends the selection forward through the next instance of the specified character. The selection is extended by moving the active end of the selection.
Example
This example collapses the current selection to an insertion point and then selects the current sentence.
Visual Basic for Applications |
---|
|
Here is an example that accomplishes the same task without the Extend method.
Visual Basic for Applications |
---|
|
This example makes the end of the selection active and extends the selection through the next instance of a capital "R".
Visual Basic for Applications |
---|
|
See Also