NextNode方法

  • 格式:doc
  • 大小:24.50 KB
  • 文档页数:1

NextNode方法
选择节点系列中的下一个图表节点。返回 DiagramNode对象,该对象代表新选
定的节点。

expression.NextNode
expression 必需。该表达式返回“应用于”列表中的对象之一。
Excel VBA教程:NextNode方法·示例
本示例创建一张组织结构图,并向中间的图表节点添加子节点。

Sub AddChildrenToMiddle()
Dim dgnRoot As DiagramNode
Dim shpDiagram As Shape
Dim dgnNext As DiagramNode
Dim intCount As Integer
'Add organization chart to current document
Set shpDiagram = ActiveSheet.Shapes.AddDiagram( _
Type:=msoDiagramOrgChart, Left:=10, _
Top:=15, Width:=400, Height:=475)
'Add three child nodes to organization chart
Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode
For intCount = 1 To 3
dgnRoot.Children.AddNode
Next
'Access the node immediately following
'the first diagram node
Set dgnNext = dgnRoot.Children.Item(1).NextNode
'Add three child nodes to the node immediately
'following the first diagram node
For intCount = 1 To 3
dgnNext.Children.AddNode
Next intCount
End Sub