Share via


parentElement Method

Returns an IHTMLElement object that represents the element that is one level up in the HTML element hierarchy.

expression.parentElement

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

Example

The following example returns the parent element of the currently selected text.

Dim objRange As IHTMLTxtRange
Dim objElement As IHTMLElement

Set objRange = ActiveDocument.selection.createRange
Set objElement = objRange.parentElement

Applies to | IHTMLTxtRange Object