How do I rename an object, such as a shape?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to manipulate a shape in VBA for PP, and so I need to assign a
specific name to that shape. How do I do it? (PowerPoint 2000)
 
Put this macro in a Module, select your object, then run this macro, type
the new name, press ENTER.

Sub NameShape()

Dim Name$

On Error GoTo AbortNameShape

If ActiveWindow.Selection.ShapeRange.Count = 0 Then

MsgBox "No Shapes Selected"

Exit Sub

End If



Name$ = ActiveWindow.Selection.ShapeRange(1).Name

Name$ = InputBox$("Give this shape a name", "Shape Name", Name$)



If Name$ <> "" Then

ActiveWindow.Selection.ShapeRange(1).Name = Name$

End If

Exit Sub

AbortNameShape:

MsgBox Err.Description


End Sub
 
Check out Example 8.7 on my site:

http://www.loyola.edu/education/PowerfulPowerPoint/

Click on Examples by Chapter and then Chapter 8 to find it. It has
procedures for finding out the name of a shape, setting the name of a
shape, finding out the name of a slide, and setting the name of a slide.

--David

--
David M. Marcovitz
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.loyola.edu/education/PowerfulPowerPoint/
 
Back
Top