Dot-Net

Excel 互操作以在禁用宏的情況下打開 excel

  • April 21, 2022

C# 中有沒有辦法在載入 excel 文件之前關閉 excel 中的宏。我正在使用 Excel 互操作載入 excel 文件。我所看到的只是 VB.NET 的解決方案。

謝謝尼山特

我想你可以在你的 Excel 應用程序上設置它:

Excel.Application xapp = new Excel.Application();
xapp.AutomationSecurity = Microsoft.Office.Core.MsoAutomationSecurity.msoAutomationSecurityForceDisable;

引用自:https://stackoverflow.com/questions/10412470