Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
Excel 2003/XP (soon to be Excel 2007/Vista :( Situation: Have a workbook with lots of shapes on various worksheets - all of which need to run essentially the same macro when they are clicked - it could be the exact same macro, if there was some way for the macro code to know which shape called it. The blindingly obvious creation of a separate macro for each shape is more than I can expect the end-users to know how (or remember) to do; a sad situation, but factual. Application.Caller doesn't work for shapes and I'm running out of good ideas to try. Since clicking on a shape doesn't select it, I can't use the .Selected property... Is this one of those "Well, who would want to do that?" things that MS either decided to ignore or never thought of - or has someone cracked this particular nut? Any help most gratefully accepted! James |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
Hi James,
Application.Caller doesn't work for shapes It does ! in the macro assigned to the shape's On Action property - Dim sCaller As String sCaller = Application.Caller MsgBox sCaller ' Select Case sCaller '' etc Regards, Peter T wrote in message oups.com... Excel 2003/XP (soon to be Excel 2007/Vista :( Situation: Have a workbook with lots of shapes on various worksheets - all of which need to run essentially the same macro when they are clicked - it could be the exact same macro, if there was some way for the macro code to know which shape called it. The blindingly obvious creation of a separate macro for each shape is more than I can expect the end-users to know how (or remember) to do; a sad situation, but factual. Application.Caller doesn't work for shapes and I'm running out of good ideas to try. Since clicking on a shape doesn't select it, I can't use the .Selected property... Is this one of those "Well, who would want to do that?" things that MS either decided to ignore or never thought of - or has someone cracked this particular nut? Any help most gratefully accepted! James |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
James,
"Application.Caller doesn't work for shapes " In my version of Excel "Application.Caller" returns the name of the shape that called the macro... "AutoShape 1" -- Jim Cone San Francisco, USA http://www.realezsites.com/bus/primitivesoftware (Excel Add-ins / Excel Programming) wrote in message Excel 2003/XP (soon to be Excel 2007/Vista :( Situation: Have a workbook with lots of shapes on various worksheets - all of which need to run essentially the same macro when they are clicked - it could be the exact same macro, if there was some way for the macro code to know which shape called it. The blindingly obvious creation of a separate macro for each shape is more than I can expect the end-users to know how (or remember) to do; a sad situation, but factual. Application.Caller doesn't work for shapes and I'm running out of good ideas to try. Since clicking on a shape doesn't select it, I can't use the .Selected property... Is this one of those "Well, who would want to do that?" things that MS either decided to ignore or never thought of - or has someone cracked this particular nut? Any help most gratefully accepted! James |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
Application.Caller doesn't work for shapes and I'm running out of
This is only working for Forms controls -- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm wrote in message oups.com... Excel 2003/XP (soon to be Excel 2007/Vista :( Situation: Have a workbook with lots of shapes on various worksheets - all of which need to run essentially the same macro when they are clicked - it could be the exact same macro, if there was some way for the macro code to know which shape called it. The blindingly obvious creation of a separate macro for each shape is more than I can expect the end-users to know how (or remember) to do; a sad situation, but factual. Application.Caller doesn't work for shapes and I'm running out of good ideas to try. Since clicking on a shape doesn't select it, I can't use the .Selected property... Is this one of those "Well, who would want to do that?" things that MS either decided to ignore or never thought of - or has someone cracked this particular nut? Any help most gratefully accepted! James |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
"Ron de Bruin" wrote in message
Application.Caller doesn't work for shapes and I'm running out of This is only working for Forms controls Works with Shapes for me, eg Rectangle, not sure about XL2007 Regards, Peter T |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Which Shape Ran The Macro?
Sorry, I misread (I was thinking about buttons)
-- Regards Ron de Bruin http://www.rondebruin.nl/tips.htm "Peter T" <peter_t@discussions wrote in message ... "Ron de Bruin" wrote in message Application.Caller doesn't work for shapes and I'm running out of This is only working for Forms controls Works with Shapes for me, eg Rectangle, not sure about XL2007 Regards, Peter T |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel Shape Macro | Excel Discussion (Misc queries) | |||
my curser changed from arrow shape to a cross shape???? | New Users to Excel | |||
Assigning Macro To Shape | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming | |||
Deleting a shape and the cell contents the shape is in. | Excel Programming |