LastChild 属性

       

返回一个 DiagramNode 对象,该对象代表父节点的最后一个子节点。

expression.LastChild

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

示例

下例向新创建的图表的最后一个子图表节点添加一个子节点。

Sub LastChildNode()

    Dim nodDiagram As DiagramNode
    Dim nodLast As DiagramNode
    Dim shDiagram As Shape
    Dim intCount As Integer

    Set shDiagram = ActiveSheet.Shapes.AddDiagram _
        (Type:=msoDiagramOrgChart, Left:=10, Top:=15, _
        Width:=400, Height:=475)
    Set nodDiagram = shDiagram.DiagramNode.Children.AddNode

    ' Add three diagram child nodes under the first diagram node
    For intCount = 1 To 3
        nodDiagram.Children.AddNode
    Next intCount

    ' Assign the last child node to a variable
    Set nodLast = nodDiagram.Children.LastChild

    ' Add a node to the last child node.
    nodLast.Children.AddNode

End Sub