how do i rename an autoshape object so i can use it in vb program

  • Thread starter Thread starter FrankD
  • Start date Start date
You might want to provide more details of what you are looking for (hint... use the large white space in the message area of your posting).
 
I don't know if this will help, but let's say you select an octagon from the
autoshape objects and it is the only autoshape on the sheet.

Sub dkd()
Sheets(1).Shapes("AutoShape 1").Name = "Stop"
MsgBox Selection.Name
End Sub

The above code would rename the shape from AutoShape 1 to Stop.
 
For intTemp = 1 To ActiveSheet.Shapes.Count
ActiveSheet.Shapes(intTemp).Name = "ShapeName"
Next

If this post helps click Yes
 
??? You can't rename all the shapes with the same name. At minimum, you
would have to do your code something like this I would think...

ShapeNames = Array("FirstName", "SecondName", "ThirdName")
For intTemp = LBound(ShapeNames) To UBound(ShapeNames)
ActiveSheet.Shapes(intTemp + 1).Name = ShapeNames(intTemp)
Next

But I'm not 100% sure that is what the OP is after; hence my request for
clarification (and my 'gentle' nudge for him to not use the Subject line to
ask his question).
 
Hi Rick

I should have mentioned that as <sheetname> instead of "sheetname" to convey
the message that it is a variable which needs to be passed.

If this post helps click Yes
---------------
Jacob Skaria


Rick Rothstein said:
??? You can't rename all the shapes with the same name. At minimum, you
would have to do your code something like this I would think...

ShapeNames = Array("FirstName", "SecondName", "ThirdName")
For intTemp = LBound(ShapeNames) To UBound(ShapeNames)
ActiveSheet.Shapes(intTemp + 1).Name = ShapeNames(intTemp)
Next

But I'm not 100% sure that is what the OP is after; hence my request for
clarification (and my 'gentle' nudge for him to not use the Subject line to
ask his question).
 
Back
Top