parentWindow 属性


返回 FPHTMLWindow2 对象,该对象代表当前文档的父窗口。


expression  必选。返回 DispFPHTMLDocument 对象的表达式。


下列示例显示当前文档父窗口的名称(如果该父窗口存在)。如果没有指定 name 属性,则向用户显示一条消息。

Sub ReturnParent()
'Returns the parent window of the active document

    Dim objApp As FrontPage.Application
    Dim objDoc As DispFPHTMLDocument
    Dim wdwParent As FPHTMLWindow2

    Set objApp = FrontPage.Application
    Set objDoc = objApp.ActiveDocument
    'Create reference to active document's parent window
    Set wdwParent = objDoc.parentWindow
    'If parent's name exists
    If Not wdwParent.Name = "" Then
        'Display names to user
        MsgBox objDoc.nameProp & "'s parent window is " _
                               & wdwParent.Name & "."
        'Display message to user
        MsgBox objDoc.nameProp &  _
               "'s parent window does not have a name or does not exist."
    End If

End Sub