contains Method
Returns True if the IHTMLElement object specified in the pChild argument is contained within the parent object.
expression.contains(pChild)
expression Required. An expression that returns one of the objects in the Applies To list.
pChild Required IHTMLElement object.
Remarks
Use the contains method to quickly determine whether an element is contained within another element.
Example
The following example uses the contains method to determine if the active element is contained within the expense form and, if it is, inserts a paragraph. This example assumes that the active document has a FORM element named "expense."
Sub AddParagraphToForm()
Dim objForm As FPHTMLFormElement
Set objForm = ActiveDocument.forms.Item("expense")
If objForm.contains(ActiveDocument.activeElement) Then
ActiveDocument.activeElement.insertAdjacentHTML _
"beforeend", "<p>This is a paragraph inside of a form.</p>"
End If
End Sub