Distinguish Save and Autosave events in Microsoft Excel Add in

邮差的信 提交于 2019-12-24 11:05:08

问题


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;

回答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



来源:https://stackoverflow.com/questions/13400645/distinguish-save-and-autosave-events-in-microsoft-excel-add-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!