SelLength, SelStart, SelText Properties
See Also
Example
Applies To
You can use these properties for tasks such as positioning the insertion point, establishing an insertion range, selecting parts of strings in a text box or combo box control, and deleting text.
- The SelLength property specifies or determines the number of characters selected in a text box or the text box portion of a combo box.
- The SelStart property specifies or determines the starting point of the selected text or the position of the insertion point if no text is selected.
- The SelText property returns a string containing the selected text. If no text is selected, the SelText property contains a Null value.
Setting
- The SelLength and SelStart properties use an Integer in the range 0 to the total number of characters in a text box or text box portion of a combo box.
- The SelText property uses a string expression that contains the text selected in the control. If the control contains selected text when this property is set, the selected text is replaced by the new SelText setting.
You can set the SelLength and SelStart properties by using a macro or Visual Basic. The SelText property is read-only.
Remarks
To set or return these properties for a control, the control must have the focus. To move the focus to a control, use the SetFocus method.
Setting the SelLength property to a number less than 0 produces a run-time error.
Setting the SelStart property to a number greater than the number of characters in the control sets the property to the existing text length.
Changing the SelStart property cancels the selection, places an insertion point in the text, and sets the SelLength property to 0.