Applies to

RichTextEdit controls


The SelectedTextLength property specifies the length of text you want to highlight in a selected text string.


Typically you use this property to obtain the length of a misspelled word that is flagged after passing the selected text string to a supported ActiveX spell checking control.

See the section called “Implementing Rich Text” in Application Techniques for more information about spell checking text in RichTextEdit controls.

In a painter

The SelectedTextLength property cannot be set in a design-time painter.

In scripts

The SelectedTextLength property takes a long value. The following code in a MixedCaseWord or ReplaceWord event for the Wintertree Software WSpell ActiveX control causes a word flagged by the control to be highlighted for its entire length, beginning with the word's offset position in the text string that you are spell checking:

 string strword
 strword = wspell.object.MisspelledWord
 rte_1.SelectedStartPos = wspell.object.WordOffset
 rte_1.SelectedTextLength = Len(strword)