TextShape Property

Microsoft Word Visual Basic

object that represents the shape of the text box associated with a diagram node.

expression.TextShape

expression    Required. An expression that returns a DiagramNode object.

Example

This example adds child nodes to a parent node and displays text in the parent node indicating the number of child nodes created.

Sub CountChildNodes()
    Dim shpDiagram As Shape
    Dim dgnNode As DiagramNode
    Dim shpText As Shape
    Dim intCount As Integer

    'Add radial diagram to the current document
    Set shpDiagram = ThisDocument.Shapes.AddDiagram _
        (Type:=msoDiagramRadial, Left:=10, _
        Top:=15, Width:=400, Height:=475)

    'Add first node to the diagram
    Set dgnNode = shpDiagram.DiagramNode.Children.AddNode

    'Add three child nodes
    For intCount = 1 To 3
        dgnNode.Children.AddNode
    Next intCount

    'Add a text box for each node in the diagram
    For intCount = 1 To 4
        Set shpText = shpDiagram.DiagramNode.Children(1).TextShape
        shpText.TextFrame.TextRange.Text = Str(intCount)
    Next intCount
End Sub