Distinguish Save and Autosave events in Microsoft

2019-08-10 08:38发布

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条回答
虎瘦雄心在
2楼-- · 2019-08-10 08:54

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

查看更多
登录 后发表回答