MoveNode Method

Moves a diagram node and any of its child nodes within a diagram.

expression.MoveNode(TargetNode, Pos)

expression Required. An expression that returns a DiagramNode object.

TargetNode   Required DiagramNode object. The diagram node where the specified node will be moved.

MsoRelativeNodePosition

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

Example

The following example moves the second diagram node of a newly-created diagram to the last node.

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

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

    'Add four child nodes to the pyramid diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    For intCount = 1 To 3
        dgnNode.AddNode
    Next intCount

    'Move the second node after the fourth node
    dgnNode.Diagram.Nodes(2).MoveNode _
        TargetNode:=dgnNode.Diagram.Nodes(4), _
        Pos:=msoAfterLastSibling
End Sub

Applies to | DiagramNode Object