Visual Studio Excel插件脚本操作不可撤消
为什么我的 Excel 插件操作不可撤消?我怎样才能让他们注册,以便运行脚本的用户能够撤消?
我的插件将数据写入单元格并覆盖数据(如果存在),但是一旦写入我就无法撤消/
Why are my excel addin actions not undoable? How can I get them to register so a user who runs the script has the ability to undo?
My addin writes data to cells and overwrites data if it exists however once written I can't undo/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否阅读过此讨论
http://www.vbforums.com/archive /index.php/t-288722.html
基本上,调用宏会清除 Excel 中的所有撤消事件。如果你仔细想想,这在一定程度上是有道理的,因为只有宏才能具体知道如何撤消其操作(例如,宏可能对文件系统或数据库执行 Excel 无法撤消的操作)。
但该线程继续描述如何将您自己的撤消事件添加到撤消堆栈中。您必须自己编写“撤消”操作的代码,但这是可行的。
Have you read through this discussion
http://www.vbforums.com/archive/index.php/t-288722.html
Basically, invoking a macro clears all the undo events in Excel. If you think about it, that makes some amount of sense, since only the macro could know specifically how to undo it's actions (as in, the macro might do things to the file system or a DB that Excel couldn't possibly undo).
But that thread goes on to describe how to add your own undo events to the undo stack. You have to code up the "undo" action yourself, but it is doable.