如何完全禁用Excel 2013 C#Api中的宏 [英] How to completely disable macros in the Excel 2013 C# Api

查看:120
本文介绍了如何完全禁用Excel 2013 C#Api中的宏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用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 is HKEY_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

可以找到更多信息 查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆