返回或设置 String 类型的值,该值代表当前文档的 HTML 源代码。可读写。
expression.documentHTML
expression 必选。返回“应用于”列表中的对象之一的表达式。
若要使插入的文本在文档中显示正确,该文本必须是有效的 HTML。该文档中当前任何文本都将被覆盖。
下列示例提示用户输入当前文档的标题。用户的输入存储在一个字符串中。然后使用 HTML 标记格式化该字符串,并将其插入文档作为标题。
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