全部显示

CloneNode 方法

       

复制指定图表的顶点。返回一个代表该顶点的 DiagramNode 对象。

expression.CloneNode(copyChildren, TargetNode, Pos)

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

copyChildren  Boolean 类型,必需。如果该参数值为 True,则同时复制图表顶点的子顶点。

TargetNode  DiagramNode 对象,可选。放置新顶点的顶点。

Pos  MsoRelativeNodePosition,可选。如果指定 TargetNode,则表示相对于 TargetNode 添加顶点的位置。

示例

以下示例创建一个图表并复制最近创建的顶点。

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