捕获 MS Office 自动形状单击事件
我认为这个问题的答案可能是不可能的,但我希望得到该主题专家的确认(遗憾的是我不是......)
我在 Excel 中制作了一组宏,其工作原理是将代码生成的宏分配给自动形状,以便在用户单击形状时执行宏。关于我所做的事情的实用性,我得到了一些很好的反馈,现在我正在考虑使用 VS 将其制作成一个插件。
我已经走了一段路,但我发现自己陷入困境,因为我无法捕获 Excel 中自动形状上的点击或任何其他事件...这意味着我必须将所有代码生成为文本在我的加载项中,将其作为模块添加到工作表中,将宏分配给自动形状,并确保特定于自动形状的对象类位于工作表类模块中... 基本上它剥夺了制作插件的全部意义。
我的问题是:有没有办法捕获 Excel 中自动形状上的单击事件?我还没有尝试过任何其他 Office 应用程序,但我非常有兴趣将其进一步应用到 Powerpoint 中。可以在Powerpoint中捕获点击事件吗?
我应该补充一点,我一直在使用我在网上找到的拼凑模板在 VS Express 中制作加载项,不幸的是速度相当慢。我一直以 Office 2003 为目标...我还无法在较新版本的 Office 上尝试此操作,但是否有可能在较新版本的 Office 中捕获这些事件?
任何见解或评论将受到欢迎。
I think the answer to this question might be that it's impossible, but I'd like to have this confirmed by experts on the subject (of which I sadly am not...)
I have made a set of macros in Excel which work by assigning code-generated macros to autoshapes so that the macros will execute when the shapes are clicked by the user. I have got some good feedback with regards to the usefulness of what I have made and now I am thinking of making this into an add-in using VS.
I got some way down the road, but I am finding myself stuck because I can not capture a click, or for that matter any other, event on an autoshape within Excel... That means that I have to generate all the code as text in my add-in, add it as a module to the worksheet, assign the macros to the autoshapes and also make sure that the autoshape-specific object classes are in the worksheet class modules...
Basically it takes away the whole point of making an add-in.
My question is: Is there any way to at all to capture a click event on an autoshape in Excel? I haven't tried any other Office apps, but I'm very interested in taking this further into Powerpoint. Would it be possible to capture click event in Powerpoint?
I should add that I have been making the add-in in VS express using a cobbled together template I found on the net, which unfortunately is quite slow. And I have been targetting Office 2003... I am not in a position to try this out with newer versions of Office yet, but might it be possible to capture those events in newer versions of Office?
Any insight or comment would be most welcome.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
恐怕 Excel 中形状没有暴露任何事件。
Excel MVP 在此 线程。
问候,
麦克斯
i'm afraid there is no event exposed by the Shapes in Excel.
This point was confirmed by an Excel MVP in this thread.
Regards,
Max