SelLength, SelStart, SelText

The SelLength property returns or sets the number of characters selected.

The SelStart property returns or sets the starting point of text selected; indicates the position of the insertion point if no text is selected.

The SelText property returns or sets the string containing the currently selected text; consists of a zero-length string ("") if no characters are selected.

Note These properties are not available at design time.

Syntax

object.SelLength [= number]

object.SelStart [= index]

object.SelText [= value]

The parts of the SelLength, SelStart, and SelText property syntaxes are described in the following table.

Part Description
object An object expression that evaluates to an object.
number A numeric expression specifying the number of characters selected. For SelLength and SelStart, the valid range of settings is 0 to text length — the total number of characters in the edit area of a ComboBox or TextBox control.
index A numeric expression specifying the starting point of the selected text, as described in Settings.
value A string expression containing the selected text.

Remarks

Use these properties for tasks such as setting the insertion point, establishing an insertion range, selecting substrings in a control, or clearing text. Used in conjunction with the Clipboard object, these properties are useful for copy, cut, and paste operations.

When working with these properties, remember that: