createTextRange Method

Returns an IHTMLTxtRange object that represents a range of text and elements in a document.

expression.createTextRange

*expression   * Required. An expression that returns one of the objects in the Applies To list.

Example

The following example searches the active document for the specified text, and then selects the text if it is found.

Dim objRange As IHTMLTxtRange
Dim blnFound As Boolean

Set objRange = ActiveDocument.body.createTextRange
blnFound = objRange.findText("search text")
If blnFound = True Then objRange.Select

Applies to | FPHTMLBody Object | FPHTMLButtonElement Object | FPHTMLInputButtonElement Object | FPHTMLInputHiddenElement Object | FPHTMLInputTextElement Object | FPHTMLTextAreaElement Object | IHTMLBodyElement Object | IHTMLButtonElement Object | IHTMLInputButtonElement Object | IHTMLInputHiddenElement Object | IHTMLInputTextElement Object | IHTMLTextAreaElement Object