Grouped shape name

J

Janie

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?
 
T

Tom Ogilvy

Sub Shp_click()
MsgBox Application.Caller
MsgBox ActiveSheet.Shapes( _
Application.Caller).ParentGroup.Name
End Sub
 
J

Joel

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

Janie

Thanks, Tom. That was it! I had tried Parent, but that gives you the name
of the worksheet.

Janie
 

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