Share via


pasteHTML Method

Pastes the specified HTML into a range within a document. If anything is selected, the selection is replaced with the new HTML and text.

expression.pasteHTML(html)

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

html    Required String. The HTML to paste. May include text as well as HTML.

Example

The following example pastes a paragraph into the current selection, replacing any text and HTML that may be selected.

Dim objRange As IHTMLTxtRange

Set objRange = ActiveDocument.selection.createRange

objRange.pasteHTML "<p>New paragraph.</p>"

Applies to | IHTMLTxtRange Object