ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   ShapeRange.Name (https://www.excelbanter.com/excel-programming/409181-shaperange-name.html)

mino[_2_]

ShapeRange.Name
 
Dear All,

1) where can I get the name of a shape put in sheet? I usually create a
macro, select it, and I find the name in the vba code.
2) is possible to assign a specify name to a shape?

Thanks to anyone
M.



Gary''s Student

ShapeRange.Name
 
Put some AutoShapes in a sheet and:

Sub qwerty()
MsgBox (ActiveSheet.Shapes.Count)
i = 0
For Each s In ActiveSheet.Shapes
MsgBox (s.Name)
s.Name = "mino" & i
i = i + 1
Next
End Sub

will tell:

1. you how many are there
2. their names
3. then re-name them
--
Gary''s Student - gsnu2007g


"mino" wrote:

Dear All,

1) where can I get the name of a shape put in sheet? I usually create a
macro, select it, and I find the name in the vba code.
2) is possible to assign a specify name to a shape?

Thanks to anyone
M.




Peter T

ShapeRange.Name
 
The last inserted shape will be the 'topmost' (assuming you haven't changed
order).

Dim shp as Shape
Set shp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count) ' fails if no shapes
shp.Name = "newUniqueName"

See 'AddShape' in help and work with 'shp'
Set shp = ActiveSheet.Shapes.AddShape(arg's...
shp.name =

Regards,
Peter T


"mino" wrote in message
...
Dear All,

1) where can I get the name of a shape put in sheet? I usually create a
macro, select it, and I find the name in the vba code.
2) is possible to assign a specify name to a shape?

Thanks to anyone
M.




mino[_2_]

ShapeRange.Name
 
Many Thanks to you and Gary"s

"Peter T" <peter_t@discussions ha scritto nel messaggio
...
The last inserted shape will be the 'topmost' (assuming you haven't
changed order).

Dim shp as Shape
Set shp = ActiveSheet.Shapes(ActiveSheet.Shapes.Count) ' fails if no
shapes
shp.Name = "newUniqueName"

See 'AddShape' in help and work with 'shp'
Set shp = ActiveSheet.Shapes.AddShape(arg's...
shp.name =

Regards,
Peter T


"mino" wrote in message
...
Dear All,

1) where can I get the name of a shape put in sheet? I usually create a
macro, select it, and I find the name in the vba code.
2) is possible to assign a specify name to a shape?

Thanks to anyone
M.







All times are GMT +1. The time now is 06:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com