Range.Expand Method
Word Developer Reference |
Expands the specified range or selection. Returns the number of characters added to the range or selection. Long.
Syntax
expression.Expand(Unit)
expression Required. A variable that represents a Range object.
Parameters
Name | Required/Optional | Data Type | Description |
---|---|---|---|
Unit | Optional | Variant | The unit by which to expand the range. Can be one of the following WdUnits constants:wdCharacter, wdWord, wdSentence, wdParagraph, wdSection, wdStory, wdCellwdColumn, wdRow, or wdTable. |
Example
This example creates a range that refers to the first word in the active document, and then it expands the range to reference the first paragraph in the document.
Visual Basic for Applications |
---|
|
This example capitalizes the first character in the selection and then expands the selection to include the entire sentence.
Visual Basic for Applications |
---|
|
See Also