返回 DispFPHTMLDocument 对象,该对象提供对 Microsoft FrontPage 中 Page 对象模型的访问,该对象模型与 Internet Explorer 4.0 及更高版本兼容。有关 Page 对象模型的详细信息,请参阅探索 FrontPage 中的对象模型。
本示例打开一个网页,然后使用 insertAdjacentText 方法在文档中添加文本。
注意 若要运行本示例,必须有一个名为 “C:\My Documents\My Webs\Rogue Cellars”(对于在 Microsoft Windows 上运行的服务器)或“C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars”(对于在 Windows NT 上运行的服务器)的站点。在两种情况下,都可以用其他站点 URL 或文件来代替。还必须有一个名为 Sales.htm 的文件,或用其他文件代替。
Private Sub AddTextToDoc()
Dim myWeb As WebEx
Dim myPageWindow As PageWindow
Dim myText As String
Set myWeb = _
Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
myWeb.Activate
myText = "Winter Sale Begins November 1st!"
Set myPageWindow = _
ActiveWeb.RootFolder.Files("Sales.htm").Edit
myPageWindow.Document.body.insertAdjacentText _
"BeforeEnd", myText
ActivePageWindow.Save
ActiveWeb.Close
End Sub