Changing a Range Object
The following list presents a summary of methods that can be used to change a given Range object:
- The Next and Previous methods
Apply to a Range or Selection object and return a Range object that refers to the next or previous item of the type to which they are applied (character, word, sentence, row, column, and so on).
- The SetRange method
Sets the starting and ending positions of an existing range or selection.
- The Start and End properties
Also set the starting and ending position of an existing range or selection.
- The StartOf and EndOf methods
Move the starting or ending position of a range or selection by a specified number of units.
- The HomeKey and EndKey methods
These methods of the Selection object mimic the action of the Home and End keys and return a Range object representing the resulting insertion point.
- The Collapse method
Collapses the range or selection to which it is applied.
- The Expand method
Expands the specified range or selection to encompass a whole unit, such as a word, sentence, or paragraph.
- The Extend method
Applies to Selection objects and extends a selection to include a specified character or to include the next complete unit of text, in the following order: word, sentence, paragraph, section, entire document.
- The Shrink method
Shrinks the selection to the next smallest complete unit of text, in the following order: word, sentence, paragraph, section, entire document.
- The WholeStory method
Expands the range or selection to include ...
Get Writing Word Macros, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.