返回 DiagramNode 对象,该对象代表图示节点集合中的最后一个图示节点。
expression.LastChild
expression 必选。该表达式返回“应用于”列表中的对象之一。
以下示例创建一个新图示并标识最后一个图示子节点。
Sub LastChildNodeHello()
Dim shpDiagram As Shape
Dim dgnNode As DiagramNode
Dim dgnLast As DiagramNode
Dim intNodes As Integer
'Add org chart to first slide and first child node
Set shpDiagram = ActivePresentation.Slides(1).Shapes.AddDiagram _
(Type:=msoDiagramOrgChart, Left:=10, Top:=15, _
Width:=400, Height:=475)
Set dgnNode = shpDiagram.DiagramNode.Children.AddNode
'Add three additional nodes
For intNodes = 1 To 3
dgnNode.Children.AddNode
Next intNodes
'Enter text into last child node
Set dgnLast = dgnNode.Children.LastChild
dgnLast.Shape.TextFrame.TextRange.Text = "Here I am!"
End Sub