NextNode Method

Microsoft PowerPoint Visual Basic

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

expression.NextNode

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

Example

The following example creates an organization chart, and adds child nodes to the middle diagram node.

Sub AddChildrenToMiddle()

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

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

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

    'Set dgnNode variable to the middle node
    Set dgnNext = dgnNode.Children.Item(1).NextNode

    'Add three child nodes to middle node
    For intNodes = 1 To 3
        dgnNext.Children.AddNode
    Next intNodes

End Sub