将源图表节点的子节点传送到接收图表节点。
expression.TransferChildren(pReceivingNode)
expression 必需。该表达式返回“应用于”列表中的对象之一。
pReceivingNode DiagramNode 对象类型,必需。从 expression 表示的节点中传送接收子节点的图表节点。
下例逐一传送新建图表的子节点。
Sub TransferChildNodes()
Dim dgnNode As DiagramNode
Dim shpDiagram As Shape
Dim intCount As Integer
'Add organizational chart to current document
Set shpDiagram = ActiveSheet.Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add first node to organizational chart
Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
'Add three child nodes to first node
For intCount = 1 To 3
dgnNode.Children.AddNode
Next intCount
'Add three child nodes to the first child node
'of the first node
For intCount = 1 To 3
dgnNode.Children.Item(1).Children.AddNode
Next intCount
'Moves the child nodes of the first child node
'so they become child nodes of the third child node
dgnNode.Children.Item(1).TransferChildren _
pReceivingNode:=dgnNode.Children.Item(3)
End Sub