ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Assigning multiple shapes to macro. (https://www.excelbanter.com/excel-programming/352638-assigning-multiple-shapes-macro.html)

ben

Assigning multiple shapes to macro.
 
At run-time, various Auto-Shapes are added and deleted, and bulk assigned to
one macro. Is there any way to determine which auto-shape called the macro?
Eg. was it Shape1,Shape2,Shape3, etc...




--
When you lose your mind, you free your life.

Tom Ogilvy

Assigning multiple shapes to macro.
 
use the caller property

Sub Generic_click()
Dim sName as String, shp as Shape
sName = Application.Caller
set shp = ActiveSheet.Shapes(sName)


end Sub

--
Regards,
Tom Ogilvy

"ben" (remove this if mailing direct) wrote in message
...
At run-time, various Auto-Shapes are added and deleted, and bulk assigned

to
one macro. Is there any way to determine which auto-shape called the

macro?
Eg. was it Shape1,Shape2,Shape3, etc...




--
When you lose your mind, you free your life.




ben

Assigning multiple shapes to macro.
 
Beautiful, thanks mate

--
When you lose your mind, you free your life.


"Tom Ogilvy" wrote:

use the caller property

Sub Generic_click()
Dim sName as String, shp as Shape
sName = Application.Caller
set shp = ActiveSheet.Shapes(sName)


end Sub

--
Regards,
Tom Ogilvy

"ben" (remove this if mailing direct) wrote in message
...
At run-time, various Auto-Shapes are added and deleted, and bulk assigned

to
one macro. Is there any way to determine which auto-shape called the

macro?
Eg. was it Shape1,Shape2,Shape3, etc...




--
When you lose your mind, you free your life.






All times are GMT +1. The time now is 07:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com