PrevNode 方法

       

返回一个 DiagramNode 对象,该对象代表图表节点集合中的上一个图表节点。

expression.PrevNode

expression   必需。该表达式返回“应用于”列表中的对象之一。

示例

本示例在一张新创建的图表中向第一个子节点添加附加子节点。

Sub AddToPrevNode()

    Dim dgnRoot As DiagramNode
    Dim shpDiagram As Shape
    Dim dgnPrev As DiagramNode
    Dim intCount As Integer

    'Add organizational chart to the current document
    Set shpDiagram = ActiveSheet.Shapes.AddDiagram( _
        Type:=msoDiagramOrgChart, _
        Left:=10, _
        Top:=15, _
        Width:=400, _
        Height:=475)

    'Add first diagram node
    Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode

    'Add three child nodes off the first diagram node
    For intCount = 1 To 3
        dgnRoot.Children.AddNode
    Next intCount

    'Access the node immediately preceeding
    'the second diagram node
    Set dgnPrev = dgnRoot.Children.Item(2).PrevNode

    'Add three child nodes to the node immediately
    'preceeding the second node
    For intCount = 1 To 3
        dgnPrev.Children.AddNode
    Next intCount

End Sub