forms Property

Microsoft FrontPage Visual Basic

forms Property

Returns an IHTMLElementCollection object that represents a collection of all FORM elements contained in a document.

expression.forms

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

Example

The following example replaces the text in the active document with a form, and then adds a new element to the form.

    Sub CreateNewForm()
    Dim objForm As FPHTMLFormElement

    ActiveDocument.body.innerHTML = "<form id=""textform"">" & vbCrLf & _
        "<textarea rows=""10"" cols=""40"" name=""textbox"" id=""textbox"">" & _
        "</textarea><br>" & vbCrLf & "<input type=""submit"" " & _
        "value=""Submit"" name=""submit"" id=""submit"">" & vbCrLf & _
        "<input type=""reset"" value=""Reset"" name=""reset"" id=""reset"">" & _
        vbCrLf & "</form>"

    Set objForm = ActiveDocument.forms.Item("textform")

    objForm.insertAdjacentHTML where:="beforeend", _
        HTML:="<input type=""checkbox"" name=""checkbox"" " & _
        "value=""ON"">Save formatted text"

End Sub