CloneNode Method

Clones a specified diagram node. Returns a DiagramNode object that represents the clone.

expression.CloneNode(copyChildren, TargetNode, Pos)

expression Required. An expression that returns a DiagramNode object.

copyChildren   Required Boolean. True to clone the diagram node's children as well.

TargetNode   Optional DiagramNode object. The node where the new node will be placed.

MsoRelativeNodePosition

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

Example

The following example creates a diagram and clones the most recently created node.

Sub CreatePyramidDiagram()
    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intCount As Integer

    'Add pyramid diagram to current document
    Set shpDiagram = ThisDocument.Shapes.AddDiagram( _
        Type:=msoDiagramPyramid, Left:=10, _
        Top:=15, Width:=400, Height:=475)

    'Add child node to the diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    For intCount = 1 To 3
        dgnNode.AddNode
    Next intCount

    'Apply automatic formatting to the diagram
    dgnNode.Diagram.AutoFormat = msoTrue

    'Clone the most recently created child node
    dgnNode.CloneNode CopyChildren:=False
End Sub

Applies to | DiagramNode Object