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

R

Rick Rothstein

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).
 
J

JLGWhiz

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.
 
J

Jacob Skaria

For intTemp = 1 To ActiveSheet.Shapes.Count
ActiveSheet.Shapes(intTemp).Name = "ShapeName"
Next

If this post helps click Yes
 
R

Rick Rothstein

??? 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).
 
J

Jacob Skaria

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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top