This project has moved. For the latest updates, please go here.

How to suppress Disable add-in dialog when Excel is force close

May 8, 2013 at 9:27 PM
When there is a modal dialog displayed, users force close Excel. Next time when they launch excel, Excel will say " Excel experienced a serious problem with the '***' add-in. If you have seen this message multiple times, you should disable this add0in and checke to see if an update is available. Do you want to disable this add-in?"

Yes, No

Users usually click Yes or enter without reading the message and then my add-in disappears from Excel. So I do not want this dialog to show up. Is it possible and how? thanks

I try to catch all exception in my addin like below. but it has no effect. thanks

public void AutoOpen()
 {           
..... System.Windows.Forms.Application.ThreadException += ApplicationOnThreadException;
         AppDomain.CurrentDomain.UnhandledException += CurrentDomainUnhandledException;
         Dispatcher.CurrentDispatcher.UnhandledException += CurrentDispatcher_UnhandledException;
         TaskScheduler.UnobservedTaskException += TaskScheduler_UnobservedTaskException;
....
}


public void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
 {
     Helper.LogError(e.Exception);            
}

public void ApplicationOnThreadException(object sender, ThreadExceptionEventArgs threadExceptionEventArgs)
 {
     Helper.LogError(threadExceptionEventArgs.Exception);
 }

public void CurrentDomainUnhandledException(object sender, UnhandledExceptionEventArgs args)
 {
     if (!(args.ExceptionObject is ThreadAbortException))
     {
         Exception exc = args.ExceptionObject as Exception;               
        Helper.LogError(exc);
     }           
}

public void CurrentDispatcher_UnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
 {
     Helper.LogError(e.Exception);
     e.Handled = true;
 }