Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Can I use VBA to assign Macro to Shape within a Group of Shapes?
You have to ungroup the shapes, assign a macro to each individual
shape and then regroup the shapes... '-- ActiveSheet.Shapes.GroupItems("Group 51").Ungroup ActiveSheet.Shapes("boxAF153").OnAction = "AF_Custom" 'assign more macros here ActiveSheet.Shapes.Range("boxAF153").ReGroup '-- MS didn't make it easy to understand. -- Jim Cone Portland, Oregon USA "MikeZz" wrote in message 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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Calculate quantity of shapes inside another shape | Excel Discussion (Misc queries) | |||
assign excel 2003 macro with parms to shape | Excel Programming | |||
VBA Help with changing shape color for selected shapes only | Excel Programming | |||
Get the name of a group given the reference to a shape within the group | Excel Programming | |||
Assign code to shape | Excel Programming |