Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify the clicked shape name in VBA

Tags:

excel

vba

I am trying to create an excel template where I have already assigned different macros to different shape that act as buttons. Now I am having problem of locating which one I have clicked since I need to modify the attributes of the clicked shape after clicking on that shape. While searching on this problem, I have noticed that there is a way to identify which shape has been selected whereas I still doesn't know How to get the name of the shape I have clicked or is there a way to refer to that clicked shape in VBA? Thank you!

like image 289
fyr91 Avatar asked Nov 04 '13 07:11

fyr91


1 Answers

You should be able to get the name of the clicked shape by using Application.Caller

usage as shown

 'Application.Caller contains a reference to the clicked Shape
 msgbox Application.Caller.Name
like image 189
Sam Avatar answered Oct 18 '22 09:10

Sam