createElement Method

Microsoft FrontPage Visual Basic

createElement Method

Creates a new IHTMLElement object that represents an HTML element based on the specified argument.

expression.createElement(eTag)

expression    Required. An expression that returns a FPHTMLDocument object.

eTag    Required. A String that represents the new HTML tag type.

Remarks

While you can use the createElement method to create any number of elements, you need to use the InsertAdjacentHTML method or the InnerHTML property to add the elements to a Web page, with the exception of the AREA element for which you would use the Add method.

Example

The following example creates a new P element (paragraph), specifies text for the new paragraph, and then inserts the new paragraph at the end of the active document.

    Dim objPara As FPHTMLParaElement

Set objPara = ActiveDocument.CreateElement("P")
objPara.innerHTML = "{NewPara}."
ActiveDocument.body.innerHTML = ActiveDocument.body _
    .innerHTML & objPara.outerHTML