Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Group Name from a macro

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!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default Group Name from a macro

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

"Excel User" wrote:

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!


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Group Name from a macro

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

"Barb Reinhardt" wrote in message
...
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

"Excel User" wrote:

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!


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 25
Default Group Name from a macro

Mich,

I have tried this but get an error message:

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

any ideas?

"MichDenis" wrote in message
...
Hi,

Have you tried this ?

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




"Excel User" a écrit dans le message de groupe de
discussion :
...
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!




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro for group total pol Excel Discussion (Misc queries) 1 February 4th 10 05:09 PM
macro to Subtotal by Group kay Excel Programming 1 July 23rd 08 02:41 PM
Group Method failed in macro Ivan Excel Programming 0 September 3rd 05 06:07 AM
Is it possible to create a macro to group? Mike Piazza Excel Discussion (Misc queries) 1 January 8th 05 12:23 AM
Macro to group outline Marcelo Excel Programming 0 October 13th 04 01:35 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"