Share via


htmlText Property

Returns a String that represents the HTML contained in the specified IHTMLTxtRange object, or if text is selected without HTML, returns the selected text with the HTML for the parent element.

expression.htmlText

*expression   * Required. An expression that returns an IHTMLTxtRange object.

Example

The following example displays the selected text and its surrounding HTML tags.

Dim objRange As IHTMLTxtRange

Set objRange = ActiveDocument.Selection.createRange
MsgBox objRange.htmlText

Applies to | IHTMLTxtRange Object