Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
986 views
Welcome To Ask or Share your Answers For Others

1 Answer

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

usage as shown

 CallingShapeName = ActiveSheet.Shapes(Application.Caller).Name 

 msgbox CallingShapeName

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...