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 |
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 |
All times are GMT +1. The time now is 02:05 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com