Group Name from a macro

E

Excel User

Hi,

I have a group that is copied several times on a spreadsheet, the group
contains several shapes (shapea, shapeb, shapec and shaped) when the user
clicks the group I would like, ask which shape to bring to front of that
group, so far I have tried

groupname = Application.Caller
whichshape= Application.InputBox ("Which Shape")

msgbox (groupname )

But the groupname displays the actual underlining shape not the group, is it
possible to get the actual group name?

Thanks!
 
B

Barb Reinhardt

This should get you started.

Sub test()
Dim myShape As Shape
Dim myShape1 As Shape

For Each myShape In ActiveSheet.Shapes
Debug.Print myShape.Name
Debug.Print myShape.GroupItems.Count
For Each myShape1 In myShape.GroupItems
Debug.Print myShape1.Name
Next myShape1

Next myShape

End Sub


HTH,
Barb Reinhardt
 
E

Excel User

Barb,

Thanks for your reply, I still do not seem to get this working, the
myShape.Name gives the name of the object within the group - how can I get
the group name?

Thanks
 
M

MichDenis

Hi,

Have you tried this ?

MsgBox Sheet1.Shapes(Application.Caller).ParentGroup.Name




"Excel User" <[email protected]> a écrit dans le message de groupe de discussion :
(e-mail address removed)...
Hi,

I have a group that is copied several times on a spreadsheet, the group
contains several shapes (shapea, shapeb, shapec and shaped) when the user
clicks the group I would like, ask which shape to bring to front of that
group, so far I have tried

groupname = Application.Caller
whichshape= Application.InputBox ("Which Shape")

msgbox (groupname )

But the groupname displays the actual underlining shape not the group, is it
possible to get the actual group name?

Thanks!
 
E

Excel User

Mich,

I have tried this but get an error message:

Run-time error
The item with the specified name wasn't found.

any ideas?
 

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