全部显示

CloneNode 方法

       

复制图示节点

expression.CloneNode(CopyChildren, TargetNode, Pos)

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

CopyChildren 必选。Boolean 类型。如果参数为 True,则包含图示子节点。

TargetNode 可选。DiagramNode 对象。该表达式返回一个 DiagramNode 对象,它将作为已复制的图示节点的源节点。

Pos 可选。MsoRelativeNodePosition 类型。如果已指定 TargetNode,则指定的值表示新添加的节点相对于 TargetNode 的位置。

示例

以下示例创建一个图示并复制一个最新创建的节点。

Sub CloneANode()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer

    'Adds cycle diagram and first child node
    Set shpDiagram = ActivePresentation.Slides(1).Shapes.AddDiagram _
        (Type:=msoDiagramCycle, Left:=10, Top:=15, _
        Width:=400, Height:=475)
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Adds three additional nodes to diagram
    For intNodes = 1 To 3
        dgnNode.AddNode
    Next intNodes

    'Automatically formats the diagram
    dgnNode.Diagram.AutoFormat = msoTrue

    'Clones the first child node without cloning associated child nodes
    dgnNode.CloneNode CopyChildren:=False

End Sub