Represents the current selection in a window or pane.
Assembly: Microsoft.Office.Interop.Word (in Microsoft.Office.Interop.Word.dll)
A selection represents either a selected (or highlighted) area in the document, or it represents the insertion point if nothing in the document is selected. There can only be one object per document window pane, and only one object in the entire application can be active.
The document doesn't have to be active to access its current selection.
Use the Text property to set or return the text in the current selection.
The object has various methods and properties with which you can:
Collapse, expand, or otherwise change the current selection.
Edit selected text in a document.
Change the formatting of the current selection.
Even when a selection is collapsed to an insertion point, it isn't necessarily empty. For example, the Text property will still return the character to the right of the insertion point; this character also appears in the Characters collection of the object. However, calling methods like Cut or Copy from a collapsed selection will cause an error.
It's possible for the user to select a region in a document that doesn't represent contiguous text (for example, when using the ALT key with the mouse). Because the behavior of such a selection can be unpredictable, you may want to include a step in your code that checks the Type property of a selection before performing any operations on it. Similarly, selections that include table cells can also lead to unpredictable behavior. The Information property will tell you if a selection is inside a table.
Because Range objects share many of the same methods and properties as objects, using Range objects is preferable for manipulating a document when there isn't a reason to physically change the current selection.