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 one of the objects in the Applies To list.
TargetNode Required DiagramNode object. The source diagram node for the move.
Pos Required MsoRelativeNodePosition. Specifies where the node will be added, relative to TargetNode.
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 after the fourth node.
Sub MoveDiagramNode()
Dim dgnNode As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
'Add pyramid diagram to the current document
Set shpDiagram = ActivePresentation.Slides(1).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 to after where the
'fourth node is currently located.
dgnNode.Diagram.Nodes(2).MoveNode _
TargetNode:=dgnNode.Diagram.Nodes(4), _
Pos:=msoAfterLastSibling
End Sub