NextNode Method [Excel 2003 VBA Language Reference]
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 dgnRoot.Children.AddNode Next '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 dgnNext.Children.AddNode Next intCount End Sub