Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试创建一个 excel 模板,其中我已经将不同的宏分配给充当按钮的不同形状。现在我在定位我点击了哪个形状时遇到了问题,因为我需要在点击该形状后修改点击形状的属性。在搜索此问题时,我注意到有一种方法可以识别已选择的形状,而我仍然不知道如何获取我单击的形状的名称,或者有没有办法引用该单击的形状在 VBA 中?谢谢!
您应该能够通过使用获取单击形状的名称Application.Caller
Application.Caller
用法如图
'Application.Caller contains a reference to the clicked Shape msgbox Application.Caller.Name
ActiveSheet.Shapes(Application.Caller).TextFrame.Characters.Text