How to completely disable macros in the Excel 2013 C# Api

懵懂的女人 提交于 2019-12-11 08:15:09

问题


I have an application that uses Excel 2013. I need a way to disable all macros. I can not do it on workbook open because I do not have access to the open methods, the workbook is opened by another COM application then passed to me. It needs to happen prior to opening the document. What I am ultimately trying to do is set the setting found in the image below.


回答1:


The best solution I found was to edit the registry. Shout out to Tim Williams for pointing me in the right direction

The key that needs to be edited is HKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Security\VBAWarnings

In my case I was to disable all macros by setting the value to 4

More info can be found Here



来源:https://stackoverflow.com/questions/44507601/how-to-completely-disable-macros-in-the-excel-2013-c-sharp-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!