Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped shape name
I know how to use ActiveSheet.Shapes(Application.Caller).Name to get the name
of the shape which is running a macro. BUT! If that shape is a GROUPED shape, that line runs the name of the individual piece, not the name of the group. What would I use to show the name of the Group? Or how about show the name of the group that the particular shape is a member of??? Any thoughts? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped shape name
Sub Shp_click()
MsgBox Application.Caller MsgBox ActiveSheet.Shapes( _ Application.Caller).ParentGroup.Name End Sub -- Regards, Tom Ogilvy "Janie" wrote: I know how to use ActiveSheet.Shapes(Application.Caller).Name to get the name of the shape which is running a macro. BUT! If that shape is a GROUPED shape, that line runs the name of the individual piece, not the name of the group. What would I use to show the name of the Group? Or how about show the name of the group that the particular shape is a member of??? Any thoughts? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped shape name
I would think it is .parent.name
I added a rectangle and an oval to my worksheet then grouped the items. the I ran this test code Sub getdim() For Each shp In Sheets("sheet1").Shapes Myname = shp.Name Next shp end sub I only had one shape on my worksheet called group 6 In group 6 I had Item1 and Items. Item1.name "rectangle 4" Item2.name "oval 5" I usually add a watch to my VBA window and then go exploring to find out the proper way to identify items. I would do someting like this set Myshape = ActiveSheet.Shapes("shape Name") then set a watch on Myshape a see if there is a parent and check the parent properties. "Janie" wrote: I know how to use ActiveSheet.Shapes(Application.Caller).Name to get the name of the shape which is running a macro. BUT! If that shape is a GROUPED shape, that line runs the name of the individual piece, not the name of the group. What would I use to show the name of the Group? Or how about show the name of the group that the particular shape is a member of??? Any thoughts? |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Grouped shape name
Thanks, Tom. That was it! I had tried Parent, but that gives you the name
of the worksheet. Janie "Joel" wrote: I would think it is .parent.name I added a rectangle and an oval to my worksheet then grouped the items. the I ran this test code Sub getdim() For Each shp In Sheets("sheet1").Shapes Myname = shp.Name Next shp end sub I only had one shape on my worksheet called group 6 In group 6 I had Item1 and Items. Item1.name "rectangle 4" Item2.name "oval 5" I usually add a watch to my VBA window and then go exploring to find out the proper way to identify items. I would do someting like this set Myshape = ActiveSheet.Shapes("shape Name") then set a watch on Myshape a see if there is a parent and check the parent properties. "Janie" wrote: I know how to use ActiveSheet.Shapes(Application.Caller).Name to get the name of the shape which is running a macro. BUT! If that shape is a GROUPED shape, that line runs the name of the individual piece, not the name of the group. What would I use to show the name of the Group? Or how about show the name of the group that the particular shape is a member of??? Any thoughts? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Grouped Items won't Stay Grouped When Moving Object | Excel Discussion (Misc queries) | |||
my curser changed from arrow shape to a cross shape???? | New Users to Excel | |||
Editting textbox value that is grouped with a shape | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming |