在Microsoft Excel中区分保存和自动保存事件 [英] Distinguish Save and Autosave events in Microsoft Excel Add in

查看:451
本文介绍了在Microsoft Excel中区分保存和自动保存事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个Microsoft Excel 2007/2010 C#Addin项目。如何区分用户自定义的保存/另存为命令和Excel自动定期调用的自动保存事件?



我知道在Microsoft Word中,我可以通过 Application.WordBasic 对象访问AutoSave事件:

  var oBasic = Application.WordBasic; 
var fIsAutoSave = oBasic.GetType()。InvokeMember(IsAutosaveEvent,BindingFlags.GetProperty,null,oBasic,null);
bool isAutoSave = int.Parse(fIsAutoSave.ToString())== 1;


解决方案

通过网络:


Excel 2003/2007中没有Autosave。 AutoRecovery保存不是
一个真正的工作簿保存。这是一个信息的保存,在另一个文件中,
显然只有Excel可以用来从崩溃中恢复。用户
无法打开此文件,或至少我无法使用。


您可以关闭自动保存功能对于您正在使用的工作簿(Excel 2003 - 现在没有其他人打开):

 工具 - > ;选项 - >保存

然后滚动您自己的自动保存。



您可能对这个主题的更多细节感兴趣的几个网站:
http:// support.microsoft.com/kb/289273



http://social.msdn.microsoft.com/Forums/eu/isvvba/thread/e044e88d-4a8d-4d75-8513-42709f08d0b2


I have two Microsoft Excel 2007/2010 C# Addin projects. How can I distinguish regular "Save"/"Save As" commands that are called by user and "AutoSave" event that is periodically invoked by Excel itself?

I know that in Microsoft Word I can access AutoSave event via Application.WordBasic object:

var oBasic = Application.WordBasic;
var fIsAutoSave = oBasic.GetType().InvokeMember("IsAutosaveEvent", BindingFlags.GetProperty, null, oBasic, null);
bool isAutoSave = int.Parse(fIsAutoSave.ToString()) == 1;

解决方案

Via the web:

There is no Autosave in Excel 2003/2007. The AutoRecovery save is not a true workbook save. It is a save of information, in another file, that apparently only Excel can use to recover from a crash. Users cannot open this file, or at least I haven't been able to.

You can turn auto save off for the workbook you are working with (Excel 2003 - don't have the other one open right now):

Tools -> Options -> Save

And then roll your own autosave.

A couple websites you might be interested in on more detail of the subject: http://support.microsoft.com/kb/289273

http://social.msdn.microsoft.com/Forums/eu/isvvba/thread/e044e88d-4a8d-4d75-8513-42709f08d0b2

这篇关于在Microsoft Excel中区分保存和自动保存事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆