You may receive an run-time error when you programmatically allow access to a Visual Basic project in Excel 2003 and in Excel 2007
For a Microsoft Excel 2002 version of this article, see 282033
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
Microsoft Office Excel 2003 and Microsoft Office Excel 2007 contain a security feature that allows you to choose whether programmatic access to the Visual Basic project is trusted.
The default setting is to not trust programmatic access to the Visual Basic project.
To allow programmatic access to the Visual Basic project, follow these steps, as appropriate for the version of Excel that you are running.
- 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.
- 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.
XL2000 XL2003 XL2007 prb XL2002 Run-time error 1004 Programmatic access to the Visual Basic Project is not trusted OfficeErrorMessages 10036 kbnoOfficeAlertID
Article ID: 813969 - Last Review: 01/13/2007 00:29:48 - Revision: 4.2
- Microsoft Office Excel 2007
- Microsoft Office Excel 2003
- kbexpertisebeginner kbprogramming kberrmsg kbprb KB813969