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