Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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

like image 606
Bruce Dou Avatar asked Apr 07 '11 02:04

Bruce Dou


People also ask

How do I get rid of the pop up message when I open an Excel file?

In Excel, select Edit Links in the Queries & Connections group on the Data tab. Click Startup Prompt. Click the Don't display the alert and don't update automatic links option.

What is primary interop assemblies redistributable?

The Microsoft Office 2010 Primary Interop Assemblies (PIA) Redistributable is a Microsoft Windows Installer package that contains the Primary Interop Assemblies for Microsoft Office 2010 products. The redistributable contains the PIAs for the following products: Microsoft Access 2010. Microsoft Excel 2010.

What is Microsoft Office Interop?

Microsoft Office Interop (Excel Automation) is an option when creating/reading Excel files (XLS, XLSX, CSV) from C# or VB.NET application, but it has many drawbacks.


1 Answers

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.

like image 56
dotNetkow Avatar answered Oct 11 '22 21:10

dotNetkow