Manipulate a file in code (VB.NET) without executing the file's macros

前端 未结 2 1931
误落风尘
误落风尘 2021-01-24 06:48

I have an Excel file that has a bunch of VBA and macro code in it. When I open the file in Excel I can choose not to \'enable\' them - so the values in the fields all stay as t

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-24 07:20

    Application.AutomationSecurity = msoAutomationSecurity.msoAutomationSecurityForceDisable
    

    Try opening the workbook after this statement. I think, this will disable macros at Application Level (not at workbook level)

    Hope that helps.

提交回复
热议问题