documentHTML Property

       

Returns or sets a String that represents the HTML source code for the current document. Read/write.

expression.documentHTML

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

Remarks

Any inserted text must be valid HTML in order to appear correctly in the document. Any text that is currently in the document will be overwritten.

Example

The following example prompts the user to enter a heading for the current document. The user input is stored in a string. The string is then formatted using HTML tags and inserted into the document as a heading.

Sub NewHeading()
'Prompts the user to enter a heaidng for the new page
'and inserts the text into the document.

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim strAns As String

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Prompt the user for a heading
    strAns = InputBox("Enter a heading for the new document")
    'Insert the new heading into the page
    objDoc.documentHTML = "<html><body><p><h1>" & _
                            strAns & "</h1></p></body></html>"

End Sub