The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

NextNode Method [Excel 2003 VBA Language Reference]

Office 2003

Selects the next diagram node in a series of nodes. Returns a DiagramNode object representing the newly-selected node.


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


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 = ActiveSheet.Shapes.AddDiagram( _
        Type:=msoDiagramOrgChart, Left:=10, _
        Top:=15, Width:=400, Height:=475)

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

    For intCount = 1 To 3

    'Access the node immediately following
    'the first diagram node
    Set dgnNext = dgnRoot.Children.Item(1).NextNode

    'Add three child nodes to the node immediately
    'following the first diagram node
    For intCount = 1 To 3
    Next intCount

End Sub

Applies to | DiagramNode Object