C# Automating Exel – Document not saved error

If you try to automate Microsoft Excel in the background with a C# Application (Microsoft.Office.Interop.Excel) after processing some documents sometimes an error "Document not saved" pops up. If you do not wish to save the document you can supress the message like this:

var excelApp = new Microsoft.Office.Interop.Excel.Application(); 
excelApp.DisplayAlerts = false;


Leave a comment

Your email address will not be published. Required fields are marked *