VBA Macro: Rename a Shape Name

Sometimes you’d need to rename a shape object from the default name to any desired name. Especially if you will deal with VBA code in the future and want to use more descriptive names for shapes and objects. This snippet will help you to rename objects easily using a Macro. To use it, just create a new Module using the developer tools and VBA and then when you need to rename an object or shape, select the shape and run the macro. You will be asked to enter a new shape.

' You can use this snippet Macro in PowerPoint to rename shapes and objects
' Select the shape in the slide where you want to rename the object and then
' run the macro to rename it. Alternatively you can use the Visibility Panel

Sub RenameShape()
    Dim objName
    On Error GoTo CheckErrors
    If ActiveWindow.Selection.ShapeRange.Count = 0 Then
        MsgBox "You need to select a shape first"
        Exit Sub
    End If
    objName = ActiveWindow.Selection.ShapeRange(1).Name
    objName = InputBox$("Assing a new name to this shape", "Rename Shape", objName)
    If objName <> "" Then
        ActiveWindow.Selection.ShapeRange(1).Name = objName
    End If

    Exit Sub

CheckErrors:
    MsgBox Err.Description

End Sub

Alternatively, you may want to use the Visibility Pane in order to reorder and rename shapes and object.

renaming shapes powerpoint

Then you can enter the new name.

rename shapes ppt

This method should be enough to rename your shapes and objects in MS PowerPoint 2007 and 2010.

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5.00 out of 5)
Loading...

Leave a Comment

Your email address will not be published. Required fields are marked *