Auto Recovered Document Doesn’t Fire Events

I ran into an interesting scenario recently in which an Auto Recovered Document – opened by the user from the Document Recovery pane does not fire the DocumentOpen, DocumentChange or WindowActivate events. This is because when you open a document from the pane, the version of the file open from the file system is closed and the version from the document recovery replaces it. This replacement happens without firing any events.


This can cause problems where, for example, you need to replace VSTO controls on the document face upon open. What you will end up with is a document that is open, but may not be properly connected to your add-in because no events fired.

In a document management system, Auto Recovery may cause more problems than it is worth. So my suggestion is – for scenarios like this – it is best to disable it for just those documents that are part of your Document Management System. Fortunately, there is a feature in Microsoft Word to disable Auto Recovery per document, see below:


And this is available from the Object Model as well:

void Application_WorkbookOpen(Microsoft.Office.Interop.Excel.Workbook Wb)
    // check to see if the document is part of documet management system
    if (isManagedDocument())
        Wb.EnableAutoRecover = false; // disable AutoRecovery just for this wb


This option when set on your managed documents will prevent the Auto Recovery situation described above, but it will also prevent the “safety net” that Auto Recovery will provide your users should something like the power go out. If Auto Recovery is needed one solution may be to create a similar feature into your add-in.

2 thoughts on “Auto Recovered Document Doesn’t Fire Events”

  1. This article talks about disabling this option in Word but the options screen and code are from Excel. Do you know how to do this in Word (if possible)? Thanks

Leave a Reply