Naming Auto Shapes and Creating new Shapes

G

Guest

When you create an AutoShape it is automatically given a name like Oval 1,
Oval 2, etc.

Is there a way to change the name that is assigned automatically so that it
is more meaningful, similar to range names?

Is there a way to find a list of all "shape" names on a particular worksheet?

If I wanted to create a special shape, say a smiley face, where the circle
could be filled. I would I go about creating, naming, and saving it?
 
G

Guest

To rename a shape, select the shape, then up where you see its name as Oval
1, Rectangle 2 etc (known as the Name Box) just highlight the current name
and type in the name you want it to have.

This macro will tell you the names of all shapes on a sheet:

Sub GetShapeNames()
Dim anyShape As Object
For Each anyShape In ActiveSheet.Shapes
MsgBox anyShape.Name
Next
End Sub

To put that into code: press [Alt]+[F11], choose Insert | Module from the VB
Editor menu and copy that code and paste it into the module. Then access the
routine from Tools | Macros | Macro in the main Excel window.

I'm afraid someone else will have to tell you how to add new shapes - that's
not something I know about, and I don't even know if it can be done.
 
G

Guest

Renaming works as you describe. I had tried this but used a space. It appears
that even though the AutoShape names have a space, i.e. Oval 1, Oval 2, etc.
You cannot rename with a space.

The macro works great. Is there a way to paste them in a separate worksheet?

JLatham said:
To rename a shape, select the shape, then up where you see its name as Oval
1, Rectangle 2 etc (known as the Name Box) just highlight the current name
and type in the name you want it to have.

This macro will tell you the names of all shapes on a sheet:

Sub GetShapeNames()
Dim anyShape As Object
For Each anyShape In ActiveSheet.Shapes
MsgBox anyShape.Name
Next
End Sub

To put that into code: press [Alt]+[F11], choose Insert | Module from the VB
Editor menu and copy that code and paste it into the module. Then access the
routine from Tools | Macros | Macro in the main Excel window.

I'm afraid someone else will have to tell you how to add new shapes - that's
not something I know about, and I don't even know if it can be done.


AL2000 said:
When you create an AutoShape it is automatically given a name like Oval 1,
Oval 2, etc.

Is there a way to change the name that is assigned automatically so that it
is more meaningful, similar to range names?

Is there a way to find a list of all "shape" names on a particular worksheet?

If I wanted to create a special shape, say a smiley face, where the circle
could be filled. I would I go about creating, naming, and saving it?
 
G

Guest

The macro will work on whatever worksheet you have activated at the time you
run it.

If you want it to go through all worksheets in a workbook:

Sub GetAllShapeNames()
Dim anySheet As Worksheets
Dim anyShape As Object
For Each anySheet in Worksheets
For each anyShape In ActiveSheet.Shapes
Msgbox AnyShape.Name & " in sheet: " & anySheet.Name
Next
Next
End Sub


AL2000 said:
Renaming works as you describe. I had tried this but used a space. It appears
that even though the AutoShape names have a space, i.e. Oval 1, Oval 2, etc.
You cannot rename with a space.

The macro works great. Is there a way to paste them in a separate worksheet?

JLatham said:
To rename a shape, select the shape, then up where you see its name as Oval
1, Rectangle 2 etc (known as the Name Box) just highlight the current name
and type in the name you want it to have.

This macro will tell you the names of all shapes on a sheet:

Sub GetShapeNames()
Dim anyShape As Object
For Each anyShape In ActiveSheet.Shapes
MsgBox anyShape.Name
Next
End Sub

To put that into code: press [Alt]+[F11], choose Insert | Module from the VB
Editor menu and copy that code and paste it into the module. Then access the
routine from Tools | Macros | Macro in the main Excel window.

I'm afraid someone else will have to tell you how to add new shapes - that's
not something I know about, and I don't even know if it can be done.


AL2000 said:
When you create an AutoShape it is automatically given a name like Oval 1,
Oval 2, etc.

Is there a way to change the name that is assigned automatically so that it
is more meaningful, similar to range names?

Is there a way to find a list of all "shape" names on a particular worksheet?

If I wanted to create a special shape, say a smiley face, where the circle
could be filled. I would I go about creating, naming, and saving it?
 

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