AddNode Method [Excel 2003 VBA Language Reference]

AddNode method as it applies to the DiagramNodeChildren object.

Creates a diagram node. Returns a DiagramNode object that represents the new node.

expression.AddNode(Index, nodeType)

expression Required. An expression that returns a DiagramNodeChildren object

Index  Optional Variant. The position of the node.

MsoDiagramNodeType

MsoDiagramNodeType can be one of these MsoDiagramNodeType constants.
msoDiagramAssistant
msoDiagramNodedefault

AddNode method as it applies to the DiagramNode object.

Creates a diagram node. Returns a DiagramNode object that represents the new node. DiagramNode object.

expression.AddNode(pos, nodeType)

expression Required. An expression that returns a DiagramNode object.

MsoRelativeNodePosition

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

MsoDiagramNodeType

MsoDiagramNodeType can be one of these MsoDiagramNodeType constants.
msoDiagramAssistant
msoDiagramNodedefault

Example

This example adds a node to a diagram node on the active sheet.

Sub DiagramNodeOBJ()

        Dim nodDiagNode As DiagramNode
        Dim shDiagram As Shape

        Set shDiagram = ActiveSheet.Shapes.AddDiagram _
            (Type:=msoDiagramOrgChart, _
            Left:=10, _
            Top:=15, _
            Width:=400, _
            Height:=475)

        Set nodDiagNode = shDiagram.DiagramNode

        'Add a root node to the diagram.
        nodDiagNode.Children.AddNode

End Sub

Applies to | DiagramNode Object | DiagramNodeChildren Collection