TextShape 属性

       

返回一个 Shape 对象,该对象代表与图表节点相关的文本框的形状。

expression.TextShape

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

示例

下例向父节点添加一个子节点,并在父节点中显示指示了创建的子节点数的文本。

Sub CountChildNodes()

    Dim nodRoot As DiagramNode
    Dim shDiagram As Shape
    Dim intCount As Integer
    Dim shText As Shape

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

    ' Add 3 child nodes to the root node.
    For intCount = 1 To 3
        nodRoot.Children.AddNode
    Next

    ' Change text in node.
    For intCount = 1 To 4
        Set shText = shDiagram.DiagramNode.Children.Item(1).TextShape
        shText.TextFrame.Characters.Text = Str(intcount)
    Next intCount

End Sub