Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel Interop to open excel with macros disabled

Is there a way in C# to switch off macros in excel before loading an excel file. I am loading the excel file using Excel Interop. All I can see is solutions for VB.NET.

Thanks Nishant

like image 428
Nishant Avatar asked May 02 '12 11:05

Nishant


1 Answers

I think you can just set it on your Excel Application:

Excel.Application xapp = new Excel.Application();
xapp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;
like image 102
John Koerner Avatar answered Oct 14 '22 00:10

John Koerner