NextNode Method

Microsoft Word Visual Basic

object in a collection of diagram nodes.

expression.NextNode

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

Remarks

Use the PrevNode method to return the previous DiagramNode object in a collection of diagram nodes.

Example

This example creates an organization chart and adds child nodes to the middle diagram node.

Sub AddChildrenToMiddle()
    Dim dgnRoot As DiagramNode
    Dim shpDiagram As Shape
    Dim dgnNext As DiagramNode
    Dim intCount As Integer

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

    'Add four child nodes to organization chart
    Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode

    For intCount = 1 To 3
        dgnRoot.Children.AddNode
    Next

    'Access the node immediately following the
    'first diagram node and add three child nodes
    Set dgnNext = dgnRoot.Children.Item(1).NextNode

    For intCount = 1 To 3
        dgnNext.Children.AddNode
    Next intCount

End Sub