Document Property (Page Object Model)

Returns an Object that represents the Web page displayed in the Microsoft FrontPage application window.

expression.Document

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

Remarks

Use the Document property to retrieve information about a document, to examine and modify the HTML elements and text within the document, and to process events.

Example

The following example specifies the title of the page and the contents of the first heading to the specified string. To call this function, use the CallSetTitleAndFirstHeading subroutine that follows.

Function SetTitleAndFirstHeading(ByRef objBody As FPHTMLBody, _
        ByVal strTitle As String) As Boolean
    
    Dim objHeading As IHTMLElement
    
    SetTitleAndFirstHeading = False
    
    Set objBody = ActiveDocument.body
    
    If InStr(1, UCase(objBody.innerHTML), UCase("h1")) < 1 Then
        objBody.insertAdjacentHTML "afterBegin", "<h1>" & strTitle & "</h1>"
    Else
        Set objHeading = objBody.Children.tags("h1").Item(0)
        objHeading.innerText = strTitle
    End If
        
    objBody.Document.Title = strTitle
    SetTitleAndFirstHeading = True
    
End Function

The following example calls the preceding SetTitleAndFirstHeading function and displays a message indicating whether the function was successful.

Sub CallSetTitleAndFirstHeading()
    Dim blnResponse as Boolean

    blnResponse = SetTitleAndFirstHeading(ActiveDocument.body, _
        "FrontPage Developer's Home Page")

    If blnResponse = True Then
        MsgBox "You have successfully changed the title " & _
            "and first heading of the current page."
    Else
        MsgBox "Title and first heading were not changed."
    End If
End Sub

Applies to | FPHTMLAnchorElement Object | FPHTMLAreaElement Object | FPHTMLBaseElement Object | FPHTMLBaseFontElement Object | FPHTMLBGsound Object | FPHTMLBlockElement Object | FPHTMLBody Object | FPHTMLBRElement Object | FPHTMLButtonElement Object | FPHTMLCommentElement Object | FPHTMLDDElement Object | FPHTMLDivElement Object | FPHTMLDivPosition Object | FPHTMLDListElement Object | FPHTMLDTElement Object | FPHTMLEmbed Object | FPHTMLFieldSetElement Object | FPHTMLFontElement Object | FPHTMLFormElement Object | FPHTMLFrameBase Object | FPHTMLFrameElement Object | FPHTMLFrameSetSite Object | FPHTMLFrontPageBotElement Object | FPHTMLHeaderElement Object | FPHTMLHRElement Object | FPHTMLIFrame Object | FPHTMLImg Object | FPHTMLInputButtonElement Object | FPHTMLInputFileElement Object | FPHTMLInputHiddenElement Object | FPHTMLInputImage Object | FPHTMLInputTextElement Object | FPHTMLIsIndexElement Object | FPHTMLLabelElement Object | FPHTMLLegendElement Object | FPHTMLLIElement Object | FPHTMLLinkElement Object | FPHTMLListElement Object | FPHTMLMapElement Object | FPHTMLMarqueeElement Object | FPHTMLMetaElement Object | FPHTMLNextIdElement Object | FPHTMLNoShowElement Object | FPHTMLObjectElement Object | FPHTMLOListElement Object | FPHTMLOptionElement Object | FPHTMLParaElement Object | FPHTMLPhraseElement Object | FPHTMLScriptElement Object | FPHTMLSelectElement Object | FPHTMLSpanElement Object | FPHTMLSpanFlow Object | FPHTMLStyleElement Object | FPHTMLTable Object | FPHTMLTableCaption Object | FPHTMLTableCell Object | FPHTMLTableCol Object | FPHTMLTableRow Object | FPHTMLTableSection Object | FPHTMLTemplateRegionElement Object | FPHTMLTextAreaElement Object | FPHTMLTextElement Object | FPHTMLTitleElement Object | FPHTMLUListElement Object | FPHTMLUnknownElement Object | FPHTMLWebPartElement Object | FPHTMLWebPartZoneElement Object | FPHTMLWindow2 Object | FPHTMLWindowProxy Object | FPHTMLXSLElement Object | FPHTMLXSLWebPartElement Object | IHTMLElement Object | IHTMLWindow2 Object