返回一个 DiagramNode 对象,该对象代表图表顶点集合中的上一个图表顶点。
expression.PrevNode
expression 必需。该表达式返回一个 DiagramNode 对象。
使用 NextNode 方法返回图表顶点集合中下一个 DiagramNode 对象。
本示例为新创建的图表的第一个子顶点添加一个子顶点。
Sub AddToPrevNode()
Dim dgnRoot As DiagramNode
Dim shpDiagram As Shape
Dim dgnPrev As DiagramNode
Dim intCount As Integer
'Add organizational chart to the current document
Set shpDiagram = ThisDocument.Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, _
Left:=10, _
Top:=15, _
Width:=400, _
Height:=475)
'Add first diagram node
Set dgnRoot = shpDiagram.DiagramNode.Children.AddNode
'Add three child nodes off the first diagram node
For intCount = 1 To 3
dgnRoot.Children.AddNode
Next intCount
'Access the node immediately preceding the second
'diagram node and add three child nodes
Set dgnPrev = dgnRoot.Children.Item(2).PrevNode
For intCount = 1 To 3
dgnPrev.Children.AddNode
Next intCount
End Sub