Body Property

Microsoft FrontPage Visual Basic

Body Property

Returns an IHTMLBody object that represents the tags and text between the opening and closing tags of the BODY element in the specified document.

expression.body

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

Remarks

Use the all property to get all elements in the body of a document, regardless of hierarchy. Use the children property to get only the top-level elements directly beneath the BODY element.

Note  In the Microsoft Internet Explorer Document Object Model, the body property can represent either a BODY or FRAMESET element, if a Web page contains frames. This is not the case with the Microsoft FrontPage Page Object Model. To access FRAMESET elements with the FrontPage Page Object Model, use the tags method of the IHTMLElementCollection object to return an FPHTMLFrameSetSite or IHTMLFrameSetElement object.

Example

The following example sets the colors for active, viewed, and regular hyperlinks, and sets the background color for the active document.

    Function ChangeLinkColors(ByRef objDoc As FPHTMLDocument, _
        ByRef Optional strALink As String, ByRef Optional strVLink As String, _
        ByRef Optional strLink As String, ByRef Optional strBGColor As String) As Boolean

    If strALink <> "" Or strVLink <> "" Or strLink <> "" Or strBGColor <> "" Then
        With objDoc.body
            .aLink = strALink
            .vLink = strVLink
            .link = strLink
            .bgColor = strBGColor
        End With
        ChangeLinkColors = True
    Else
        ChangeLinkColors = False
    End If
End Function
  

Use the following example to call the preceding function.

    Sub CallChangeLinkColors()
    Call ChangeLinkColors(objDoc:=ActiveDocument, strALink:="blue", _
        strVLink:="yellow", strLink:="green", strBGColor:="black")
End Sub