返回一个 IHTMLDocument2 对象,该对象代表预览窗口中的文档。只读。
expression.PreviewDocument
expression 必选。返回 PageWindowEx 对象的表达式。
如果活动窗口当前不是预览模式,则 PreviewDocument 属性不返回任何值。
以下示例显示当前预览模式中的文档的标题。如果预览模式中没有文档,则会向用户显示一条消息。
Sub PreviewDocument()
'Displays the title of the document currently in preview mode
Dim FPApp As FrontPage.Application
Dim objPageWindow As PageWindowEx
Set FPApp = FrontPage.Application
Set objPageWindow = FPApp.ActivePageWindow
'If the page window is in preview mode, display the title
If objPageWindow.ViewMode = fpPageViewPreview Then
MsgBox "The title of the document is: " _
& objPageWindow.PreviewDocument.Title
Else
MsgBox "The page window is not in preview mode."
End If
End Sub