问题描述
我有一个使用Excel 2013的应用程序.我需要一种禁用所有宏的方法.我无法在打开工作簿时执行此操作,因为我无法访问打开方法,该工作簿由另一个COM应用程序打开,然后传递给我.它需要在打开文档之前发生.我最终想要做的是设置下图中的设置.
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.
推荐答案
我发现的最佳解决方案是编辑注册表.向蒂姆·威廉姆斯大喊,向我指出正确的方向
The best solution I found was to edit the registry. Shout out to Tim Williams for pointing me in the right direction
需要编辑的密钥是HKEY_CURRENT_USER \ Software \ Microsoft \ Office \ 15.0 \ Excel \ Security \ VBAWarnings
The key that needs to be edited isHKEY_CURRENT_USER\Software\Microsoft\Office\15.0\Excel\Security\VBAWarnings
就我而言,我是通过将值设置为4来禁用所有宏
In my case I was to disable all macros by setting the value to 4
可以找到更多信息此处
这篇关于如何完全禁用Excel 2013 C#Api中的宏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!