How to disable popups when opening a file using Microsoft.Office.Interop

Bruce Dou picture Bruce Dou · Apr 7, 2011 · Viewed 31.9k times · Source

Such as read-only confirm, other alerts. What to do with these popups? Or ignore them?

Answer

dotNetkow picture dotNetkow · Apr 7, 2011

See my answer here.

Basically, you disable all alerts via the "Display Alerts" method:

Microsoft.Office.Interop.[OFFICE_APP].Application app = new Microsoft.Office.Interop.[OFFICE_APP].Application();
app.DisplayAlerts = false;

where [OFFICE_APP] is the name of the Office program you're using, such as Word, Excel, etc.