CloneNode Method

Microsoft Word Visual Basic

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.

Pos   Optional MsoRelativeNodePosition. IfTargetNode is specified, indicates where the node will be added relative to TargetNode.

MsoRelativeNodePosition can be one of these MsoRelativeNodePosition constants.
msoAfterLastSibling
msoAfterNode default
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