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 DispFPHTMLDocument object.
eTag Required. A String that represents the new HTML tag type.
Only new <IMG> and <OPTION> element tags can be created. Before they can be used, new objects must be explicitly added to their respective collections.
The following example creates a new <P> element. The <P> element corresponds to the HTML paragraph tag.
Sub CreateElement()
'Creates a new element
Dim objDoc As DispFPHTMLDocument
Dim objTag As IHTMLElement
Set objDoc = FrontPage.ActiveDocument
'Create new tag
Set objTag = objDoc.CreateElement("P")
objDoc.body.innerHTML = objDoc.body.innerHTML & objTag.outerHTML
End Sub
The following example creates a new <IMG> tag without creating a new object to reference it.
Sub NewElement()
'Creates a new <IMG> element
Dim objDoc As DispFPHTMLDocument
Set objDoc = FrontPage.ActiveDocument
'Create new IMG tag
objDoc.body.innerHTML = objDoc.body.innerHTML & _
objDoc.createElement (eTag:="IMG").outerHTML
End Sub