Running either of the code examples here will generate an error:
Screenshot 2025-02-10 195119.png
unless you have given permission for VBA to access the code project
To grant permission:
- File | Options | Trust Center | Trust Center Settings
Screenshot 2025-02-10 195903.png
- Check the option to Trust access to the VBA project object model
Screenshot 2025-02-10 195740.png
NB: This is not generally considered a safe thing to do unless you really know what you are doing as it will also allow malware access.