Share via


_Slide.Shapes Property

Returns a CanvasShapes collection that represents all the elements that have been placed or inserted on the specified slide, slide master, or range of slides. Read-only.

Namespace:  Microsoft.Office.Interop.PowerPoint
Assembly:  Microsoft.Office.Interop.PowerPoint (in Microsoft.Office.Interop.PowerPoint.dll)

Syntax

'Declaration
ReadOnly Property Shapes As Shapes
    Get
'Usage
Dim instance As _Slide
Dim value As Shapes

value = instance.Shapes
Shapes Shapes { get; }

Property Value

Type: Microsoft.Office.Interop.PowerPoint.Shapes
Shapes

Remarks

The Shapes collection returned can contain the drawings, shapes, OLE objects, pictures, text objects, titles, headers, footers, slide numbers, and date and time objects on a slide, or on the slide image on a notes page.

Examples

This example adds a rectangle that's 100 points wide and 50 points high, and whose upper-left corner is 5 points from the left edge of slide one in the active presentation and 25 points from the top of the slide.

Set firstSlide = ActivePresentation.Slides(1)

firstSlide.Shapes.AddShape msoShapeRectangle, 5, 25, 100, 50

This example sets the fill texture for shape three on slide one in the active presentation.

Set newRect = ActivePresentation.Slides(1).Shapes(3)

newRect.Fill.PresetTextured msoTextureOak

Assuming that slide one in the active presentation contains a title, both the second and third lines of code in the following example set the title text on slide one in the presentation.

Set firstSl = ActivePresentation.Slides(1)

firstSl.Shapes.Title.TextFrame.TextRange.Text = "Some title text"

firstSl.Shapes(1).TextFrame.TextRange.Text = "Other title text"

Assuming that shape two on slide two in the active presentation contains a text frame, the following example adds a series of paragraphs to the slide. Note that Chr(13) is used to insert paragraph marks within the text.

Set tShape = ActivePresentation.Slides(2).Shapes(2)

tShape.TextFrame.TextRange.Text = "First Item" & Chr(13) & _

    "Second Item" & Chr(13) & "Third Item"

For most slide layouts, the first shapes on the slide are text placeholders, and the following example accomplishes the same task as the preceding example.

Set testShape = ActivePresentation.Slides(2).Shapes.Placeholders(2)

testShape.TextFrame.TextRange.Text = "First Item" & _

    Chr(13) & "Second Item" & Chr(13) & "Third Item"

See Also

Reference

_Slide Interface

_Slide Members

Microsoft.Office.Interop.PowerPoint Namespace