I'm running some code on XP Excel 2007 and receive the error below
Runtime error '1004'
Programmatic access to Visual Basic Project is not trusted.
I found a solution to this issue - used it and it DOES solve the issue - no more error and my program executes correctly on the XP Excel 2007 system where it previously failed
(NOTE: This same code works correctly on my XP Excel 2000 system)
------------------------------------------------------------------------------------------------------------
From the MS KB Article #812969
http://support.microsoft.com/kb/813969
States:
When you run code that uses the Microsoft Visual Basic for Applications Extensibility 5.3
Library, you may receive the following error message:
Run-time error '1004': Programmatic access to the Visual Basic Project is not trusted
Solution:
Excel 2007
Click the Microsoft Office Button, and then click Excel Options.
Click Trust Center.
Click Trust Center Settings.
Click Macro Settings.
Click to select the Trust access to the VBA project object model check box.
Click OK to close the Excel Options dialog box.
Excel 2003
On the Tools menu, point to Macro, and then click Security.
In the Security dialog box, click the Trusted Sources tab.
Select the Trust access to Visual Basic Project check box.
Click OK.
------------------------------------------------------------------------------------------------------------
Is there a way for me to turn this setting ON programatically when I need it?
Thanks,
BTW: A better solution would be - get the setting that the user has, set it to what I need to not CRASH, then return back to the USERS setting after I'm done.
Bookmarks