body Property

       

Returns an IHTMLElement that corresponds to the enclosed body tags of the HTML page. The HTML body element defines certain settings of the page such as text color and background color.

expression.body

expression   Required. An expression that returns a DispFPHTMLDocument object.

Example

The following example creates a reference to the body element and modifies its background and text color. The document background will now appear white and the foreground text will appear blue.

Sub DocumentBody()
'Returns the active HTML document and modifies the body

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim objPgeWdw As PageWindowEx
    Dim objBody As IHTMLBodyElement

    Set objApp = FrontPage.Application
    'Create reference to active page window
    Set objPgeWdw = objApp.ActivePageWindow
    'Create reference to open document
    Set objDoc = objPgeWdw.Document
    Set objBody = objDoc.body

    'Set background color to white and text color to blue
    With objBody
        .bgColor = "FFFFFF"
        .Text = "3333FF"
    End With

End Sub