AddNode Method

Microsoft PowerPoint Visual Basic

Show All

AddNode Method

       

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.

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

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