Extending the Selection

When you use the Selection object, it's important to know how to manipulate the currently selected text by extending the selection. The simplest way to extend the selection is with the various Move commands that either move the insertion point or extend the selection in a particular direction:

Selection.MoveDown([Unit][, Count][, Extend]) Selection.MoveLeft([Unit][, Count][, Extend]) Selection.MoveRight([Unit][, Count][, Extend]) Selection.MoveUp([Unit][, Count][, Extend])

Unit (optional) Specifies the unit by which the insertion point is moved or the selection is extended. For regular text, use wdCharacter, wdWord, wdLine (this is the default), wdSentence, wdParagraph, wdSection, or wdStory. In a table, use wdColumn, or wdRow.

Count (optional) The number of units by which the insertion point is moved or the selection is extended (the default is 1).

Extend (optional) Specifies what happens to the selection. To extend the selection to the end of the specified number of Units, use wdExtend; to collapse the selection to the insertion point, use wdMove (this is the default).

Listing 7.7 offers a procedure that puts a couple of these methods to the text.

0 0

Post a comment