全部显示

MoveNode 方法

       

在图示内移动节点及其任何子节点。

expression.MoveNode(TargetNode, Pos)

expression  必选。该表达式返回“应用于”列表中的对象之一。

TargetNode  必选。DiagramNode 对象。要移动的源图示节点。

Pos  必选。MsoRelativeNodePosition 类型。相对于 TargetNode 指定添加节点的位置。

示例

以下示例将新建图示的第二个图示节点移动到第四个节点之后。

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