Adds a DiagramNode object to a collection of child diagram nodes.
expression.AddNode(Index)
expression Required. An expression that returns a DiagramNodeChildren object.
Index Optional Variant. The index location of where to add the new diagram node: 0 adds before all nodes, -1 adds after all nodes, and any other Index number will add after that node in the collection.
AddNode method as it applies to the DiagramNode object.
Creates a diagram node, returning a DiagramNode object that represents the new diagram node. For conceptual diagrams, the DiagramNode object is added to the end of the shapes list.
expression.AddNode(Pos)
expression Required. An expression that returns a DiagramNode object.
Pos Optional MsoRelativeNodePosition. Specifies where the node will be added, relative to the calling node.
MsoRelativeNodePosition can be one of these MsoRelativeNodePosition constants. |
msoAfterLastSibling |
msoAfterNode default |
msoBeforeFirstSibling |
msoBeforeNode |
Example
As it applies to the DiagramNodeChildren object.
This example adds a pyramid chart to the current document and adds three nodes to the chart.
Sub CreatePyramidDiagram()
Dim dgnNode As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
'Add pyramid diagram to the current document
Set shpDiagram = ThisDocument.Shapes.AddDiagram _
(Type:=msoDiagramPyramid, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add first diagram node child to the pyramid diagram
Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
'Add three more diagram node children to the pyramid diagram
For intCount = 1 To 3
dgnNode.AddNode
Next intCount
End Sub