Name Property

Applies To

AddIn object, Application object, Font object, Master object, NamedSlideShow object, Presentation object, Shape object, ShapeRange collection object, Slide object, SlideRange collection object, SoundEffect object.

Description

Returns or sets the name of the specified object. 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 1") will return a reference to that shape. The following table contains information about the Name property for each object it applies to.

Object

Name property details

AddIn

The name of the add-in includes the file name extension (for file types that are registered) but doesn't include its path. Read-only String.

Application

Returns the string "Microsoft PowerPoint." Read-only String.

Font

Read/write String.

Master

Read/write String.

NamedSlideShow

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

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.

Shape or ShapeRange (the shape range must contain exactly one shape)

When a shape is created, 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. Read/write String.


(continued)

Object

Name property details

Slide or SlideRange (the slide range must contain exactly one slide)

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. Read/write String.

SoundEffect

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


See Also

FullName property, Path property.

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)