Visual Studio Excel插件脚本操作不可撤消

发布于 2024-11-03 17:50:40 字数 99 浏览 3 评论 0原文

为什么我的 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

谈情不如逗狗 2024-11-10 17:50:40

您是否阅读过此讨论

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文