VBA 在工作簿打开时自动启用“宏”?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/19640115/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
VBA automatically enables "macros" when workbook is open?
提问by MaM
This may be a silly question, but can someone enable automatically the VBA scripts / macros when a workbook is open? Without going through the path file > options > security > macros > enable.
这可能是一个愚蠢的问题,但是有人可以在工作簿打开时自动启用 VBA 脚本/宏吗?无需通过路径文件> 选项> 安全性> 宏> 启用。
I know this is there for security reasons and this is probably not possible. it is just a question out of curiosity.
我知道这是出于安全原因,这可能是不可能的。这只是出于好奇而提出的问题。
回答by Seth
Nope. Macro functionality has to be enabled for each user, or set by an admin using the registry.
不。必须为每个用户启用宏功能,或者由管理员使用注册表进行设置。
回答by skkakkar
Put all macros in a file personal.xlsm (Office 2007)and put this file in microsoft office XLSTART folder. Let it contain generic name of the files to be operated. This macrofile wiill open with all the macros when you open new instance of excel.Choose the macro in view macro. Rename your file to generic name specified in macro. Operate the macro then again change the file generic name to original name. Follow similiar process for other files. This way multiple macros can be operated on multiple files. Suitably adopt this approach to your version of Office. If you do not have administer privileges then you have to make a folder containing macro file as trusted location.
将所有宏放在一个文件personal.xlsm (Office 2007) 中,并将这个文件放在microsoft office XLSTART 文件夹中。让它包含要操作的文件的通用名称。当您打开 excel 的新实例时,此宏文件将与所有宏一起打开。在视图宏中选择宏。将文件重命名为宏中指定的通用名称。操作宏然后再次将文件通用名称更改为原始名称。对其他文件执行类似的过程。这样可以在多个文件上操作多个宏。对您的 Office 版本适当地采用这种方法。如果您没有管理员权限,则必须将包含宏文件的文件夹设为受信任位置。
回答by Gary's Student
Place the workbook in a Trusted Location.................
将工作簿放在受信任的位置......................