Shape.Name property (PowerPoint)

When a shape is created, Microsoft PowerPoint automatically assigns it a name in the form ShapeType Number, where ShapeType identifies the type of shape or AutoShape, and Number is an integer that's unique within the collection of shapes on the slide. For example, the automatically generated names of the shapes on a slide could be Placeholder 1, Oval 2, and Rectangle 3. To avoid conflict with automatically assigned names, don't use the form ShapeType Number for user-defined names, where ShapeType is a value that is used for automatically generated names, and Number is any positive integer. A shape range must contain exactly one shape. Read/write.

Syntax

expression.Name

expression A variable that represents a Shape object.

Return value

String

Remarks

You can use the object's name in conjunction with the Item method to return a reference to the object if the Item method for the collection that contains the object takes a Variant argument. For example, if the value of the Name property for a shape is Rectangle 2, .Shapes("Rectangle 2") returns a reference to that shape.

Example

This example sets the name of object two on slide one in the active presentation to "big triangle."

ActivePresentation.Slides(1).Shapes(2).Name = "big triangle"

This example sets the fill color for the shape named "big triangle" on slide one in the active presentation.

ActivePresentation.Slides(1) _
    .Shapes("big triangle").Fill.ForeColor.RGB = RGB(0, 0, 255)

See also

Shape Object

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.