Share via


Name Property

Name Property
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.  

Name property as it applies to the ColorFormat, Design, Font, Master, Shape, ShapeRange, Slide, SlideRange, and SoundEffect objects.

ColorFormat, Design, Font, and Master objects: Returns or sets the name of the specified object. Read/write String.

Shape or ShapeRange objects. 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 String.

Slide or SlideRange objects: When a slide is inserted into a presentation, PowerPoint automatically assigns it a name in the form Sliden, where n is an integer that represents the order in which the slide was created in the presentation. For example, the first slide inserted into a presentation is automatically named Slide1. If you copy a slide from one presentation to another, the slide loses the name it had in the first presentation and is automatically assigned a new name in the second presentation. A slide range must contain exactly one slide. Read/write String.

SoundEffect object: The set of valid names for a presentation appears in the Sound box in the Slide Transition task pane (Slide Show menu). Read/write String.

expression.Name

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

 

Name property as it applies to the AddIn, Application, NamedSlideShow, and Presentation objects.

AddIn object: The name (title) of the add-in for file types that are registered. Read-only String.

Application object: Returns the string "Microsoft PowerPoint." Read-only String.

NamedSlideShow object: You cannot use this property to set the name for a custom slide show. Use the Add method to redefine a custom slide show under a new name. Read-only String.

Presentation object: The name of the presentation includes the file name extension (for file types that are registered) but doesn't include its path. You cannot use this property to set the name. Use the SaveAs method to save the presentation under a different name if you need to change the name. Read-only String.

expression.Name

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

 

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, then .Shapes("Rectangle 2") will return a reference to that shape.

Example

As it applies to the Shape object. 

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)