What does the checkbox “Trust access to the VBA Pr

2019-09-07 17:41发布

问题:

"Trust access to the VBA project model" is something I instinctively click on right after "Enable all macros", simply because I don't have time to workout whether or not it will break the code I would like to run.

This is naughty - I should know what I'm doing and the implications. Assuming I've enabled all macros already, what extra features/dangers are exposed to me when I open the Pandora's Box of trusting access to the VBA project model?

This line of code runs without trusting access:

VBAProject.Sheet1.Calculate

Please would you post some code that requires trusted access?

回答1:

It allows your code to access the VBA project by doing such things as reading and altering other code or changing the codenames of objects. Basically it controls access to the properties and methods of anything you access via the Workbook.VBProject property.