全部显示

MoveNode 方法

       

移动图表顶点以及图表之内的子顶点。

expression.MoveNode(TargetNode, Pos)

expression   必需。该表达式返回一个 DiagramNode 对象。

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 = 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