Grant your code access to the VBProjects
2006-05-16 VBE 0 59
In Excel versions prior to 2003 you could access your VBProjects using code, as long as the VBProjects was unprotected.
In Excel 2003 or later, access to the VBProjects using code is restricted by default.
If you want to use VBA code to alter the contents of a VBProject you have to tell the application (e.g. Excel or Word) to allow this.
This can be done using the menu Tools, Macro, Security...
The Security dialog will open and you can activate the Trusted Publishers tab.
Check the option Trust access to Visual Basic Project and click the OK-button to close the dialog.
You can now access unprotected VBProjects with your code from Excel 2003 or later.