PrevNode Method

Microsoft PowerPoint Visual Basic

object that represents the previous diagram node in a collection of diagram nodes.

expression.PrevNode

expression    Required. An expression that returns one of the objects in the Applies To list.

Example

The following example adds additional child nodes to the first child node, which is the node previous to the second node, in a newly-created diagram.

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