View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
MikeZz MikeZz is offline
external usenet poster
 
Posts: 152
Default Can I use VBA to assign Macro to Shape within a Group of Shapes?

Hi,
I have a group of shapes pre-built in one workbook that I want to copy to
another, then assign all the individual shapes to execute various macros in
the finished workbook.

I figured out how to do this on individual shapes this way:
ActiveSheet.Shapes("boxAF153").OnAction = "AF_Custom"

The question is if the shapes are copied over as part of a group, and I want
them to remain in a group, how do I refer to an individual shape within a
group?

I've tried the following but all give me "error 438".
The name of the shape Group is "Group 51" and one of the indvidual shapes is
"boxAF153"

ActiveSheet.Shapes.GroupItems("Group 51").Item("boxAF153").OnAction =
"AF_Custom"
ActiveSheet.GroupShapes(1).Items(1).OnAction = "AF_Custom"

Thanks for any help,
MikeZz