Export (0) Print
Expand All

LastChild Property

Office 2003

Returns a DiagramNode object representing the last diagram node in a collection of diagram nodes.


expression    Required. An expression that returns one of the objects in the Applies To list.


The following example creates a new diagram and identifies the last child diagram node.

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
    Next intNodes

    'Enter text into last child node
    Set dgnLast = dgnNode.Children.LastChild
    dgnLast.Shape.TextFrame.TextRange.Text = "Here I am!"

End Sub

© 2014 Microsoft