ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro-calling shape (https://www.excelbanter.com/excel-programming/438891-macro-calling-shape.html)

H.G. Lamy

Macro-calling shape
 
Hello,

can the actual macro-calling shape be identified when there are 2 shapes
assigned to the same VBA-procedure ?

Thank you in advance.

Regards,

hglamy




Dave Peterson

Macro-calling shape
 
Try:

msgbox application.caller

You'll see the name of the shape that's calling the macro...

You can use:

dim myShape as shape
set myshape = activesheet.shapes(application.caller)

then use all the properties for that shape

msgbox myshape.name & vblf & myshape.topleftcell.address & ...

"H.G. Lamy" wrote:

Hello,

can the actual macro-calling shape be identified when there are 2 shapes
assigned to the same VBA-procedure ?

Thank you in advance.

Regards,

hglamy


--

Dave Peterson

Gary''s Student

Macro-calling shape
 
Sub dural()
MsgBox Application.Caller
End Sub

--
Gary''s Student - gsnu201001


"H.G. Lamy" wrote:

Hello,

can the actual macro-calling shape be identified when there are 2 shapes
assigned to the same VBA-procedure ?

Thank you in advance.

Regards,

hglamy



.


H.G. Lamy

Macro-calling shape
 
Thank you, Dave

hgl

"Dave Peterson" wrote in message
...
Try:

msgbox application.caller

You'll see the name of the shape that's calling the macro...

You can use:

dim myShape as shape
set myshape = activesheet.shapes(application.caller)

then use all the properties for that shape

msgbox myshape.name & vblf & myshape.topleftcell.address & ...

"H.G. Lamy" wrote:

Hello,

can the actual macro-calling shape be identified when there are 2 shapes
assigned to the same VBA-procedure ?

Thank you in advance.

Regards,

hglamy


--

Dave Peterson





All times are GMT +1. The time now is 09:14 AM.

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