Name related procedures in class Shape (PowerPoint VBA)

This page presents procedures from class Shape related to the theme Name: Placeholders.FindByName, Name, Title, ShapeRange.Name, ShapeRange.Title, Shapes.HasTitle and Shapes.Title

Placeholders.FindByName

Finds the placeholder in the Placeholders collection at the specified index location or with the specified name.

Because it takes a Variant, the FindByName method makes it possible to locate a member of the Placeholders collection by specifying either the index number (an Integer or Long) or the name (a String) of an individual placeholder. Unlike the corresponding methods of other collections, such as Shapes or Slides, the Item method of the Placeholders collection takes only a Long.

Syntax : expression.FindByName (Index)

Index: The index of the placeholder to be found.

Dim lngIndex As Long: lngIndex = 
Dim shpFindByName As Shape
Set shpFindByName = "Dogs" ActiveWindow.Selection.SlideRange(1).Shapes.Placeholders.FindByName(Index:=lngIndex)

Name

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.

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.

ActivePresentation.Slides(1).Shapes(1).Name =

Title

Returns a Shape object that represents the slide title.

You can also use the Item method of the Shapes or Placeholders collection to return the slide title.

ActivePresentation.Slides(1).Shapes(1).Title =

ShapeRange.Name

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.

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.

ActiveWindow.RangeFromPoint.Ungroup.Name =

ShapeRange.Title

Returns a Shape object that represents the slide title.

You can also use the Item method of the Shapes or Placeholders collection to return the slide title.

ActivePresentation.Slides(1).Shapes(1).Ungroup.Title = "Welcome!"

Shapes.HasTitle

Returns whether the collection of objects on the specified slide contains a title placeholder.

The value of the HasTitle property can be one of these MsoTriState constants.

Dim mtsHasTitle As Office.MsoTriState
mtsHasTitle = ActiveWindow.Selection.SlideRange(1).Shapes.HasTitle

Shapes.Title

Returns a Shape object that represents the slide title.

You can also use the Item method of the Shapes or Placeholders collection to return the slide title.

Dim shpTitle As Shape
Set shpTitle = ActiveWindow.Selection.SlideRange(1).Shapes.Title