PrevNode 方法

       

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

expression.PrevNode

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

示例

以下示例向第一个子节点中添加附加的子节点,第一个子节点是新建图示中位于第二个节点前的节点)。

Sub AddNodeToFirstChild()

    Dim dgnNode As DiagramNode
    Dim dgnPrev As DiagramNode
    Dim shpOrgChart As Shape
    Dim intNodes As Integer

    'Adds org chart and root node
    Set shpOrgChart = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpOrgChart.DiagramNode.Children.AddNode

    'Adds three child nodes to root node
    For intNodes = 1 To 3
        dgnNode.Children.AddNode
    Next intNodes

    'Sets dgnPrev equal to first child node (the node
    'previous to the second child node)
    Set dgnPrev = dgnNode.Children.Item(2).PrevNode

    'Adds three child nodes to first child node
    For intNodes = 1 To 3
        dgnPrev.Children.AddNode
    Next intNodes

End Sub