Share via


AddNode Method

AddNode Method
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

AddNode method as it applies to the DiagramNodeChildren object.

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; any other Index will add after that node in the collection.

AddNode method as it applies to the DiagramNode object.

Returns a DiagramNode object that represents a node added to a diagram.

expression.AddNode(Pos)

expression   Required. An expression that returns a DiagramNode object.

MsoRelativeNodePosition

MsoRelativeNodePosition can be one of these MsoRelativeNodePosition constants.
msoAfterLastSibling
msoAfterNodedefault
msoBeforeFirstSibling
msoBeforeNode

Example

The following example adds nodes to a newly-created diagram.

  Sub CreatePyramidDiagram()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer

    'Adds the pyramid diagram and first node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes _
        .AddDiagram(Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Adds three more nodes to pyramid diagram
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

End Sub