Pane 对象

         
Windows (Window)
Panes (Pane)
多种对象

代表一个窗格。Pane 对象为 Panes 集合的一个成员。Panes 集合包含了一个窗口中的所有窗格。

使用 Pane 对象

可用 Panes(index) 返回一个 Pane 对象,其中 index 为索引号。下例关闭活动窗格。

If ActiveDocument.ActiveWindow.Panes.Count >= 2 Then _
    ActiveDocument.ActiveWindow.ActivePane.Close

可用 Add 方法或 Split 属性添加一个窗格。下例按活动窗口尺寸的 20% 拆分活动窗口。

ActiveDocument.ActiveWindow.Panes.Add SplitVertical:=20

下例平分活动窗口。

ActiveDocument.ActiveWindow.Split = True

可用 SplitSpecial 属性显示一个独立窗格的备注、脚注或尾注。

说明

当窗口被拆分或在非页面视图下显示脚注、备注等信息时,窗口具有多个窗格。下例在普通视图中显示备注窗格,然后提示关闭该窗格。

ActiveDocument.ActiveWindow.View.Type = wdNormalView
If ActiveDocument.Comments.Count >= 1 Then
    ActiveDocument.ActiveWindow.View.SplitSpecial = wdPaneComments
    response = _
        MsgBox("Do you want to close the comments pane?", vbYesNo)
    If response = vbYes Then _
        ActiveDocument.ActiveWindow.ActivePane.Close
End If