Share via


Shape Property

Returns a Shape object that represents a shape in a table cell (for the Cell object), a diagram node in a diagram (for the DiagramNode object), or an animated shape (for the Effect object).

expression.Shape

*expression   * Required. An expression that returns one of the above objects.

Example

This example creates a 3x3 table in a new presentation and inserts a four-pointed star into the first cell of the table.

With Presentations.Add
    With .Slides.Add(1, ppLayoutBlank)
        .Shapes.AddTable(3, 3).Select
        .Shapes(1).Table.Cell(1, 1).Shape _
            .AutoShapeType = msoShape4pointStar
    End With
End With

The following example creates a diagram and adds child nodes to the root mode. As each child is added, the root node displays the number of child nodes it has.

Sub CountChildNodes()

    Dim dgnNode As DiagramNode
    Dim shpDiagram As Shape
    Dim intNodes As Integer

    Set shpDiagram = ActivePresentation.Slides(1).Shapes.AddDiagram _
        (Type:=msoDiagramRadial, Left:=10, Top:=15, _
        Width:=400, Height:=475)
    shpDiagram.DiagramNode.Children.AddNode

    Set dgnNode = shpDiagram.DiagramNode.Root

    For intNodes = 1 To 3
        dgnNode.Children.AddNode
        dgnNode.Shape.TextFrame.TextRange.Text = intNodes
    Next intNodes

End Sub

Applies to | Cell Object | DiagramNode Object | Effect Object

See Also | Working with Tables