You may receive an run-time error when you programmatically allow access to a Visual Basic project in Excel 2003 and in Excel 2007

Article translations Article translations
Article ID: 813969 - View products that this article applies to.
For a Microsoft Excel 2002 version of this article, see 282033.
Expand all | Collapse all

On This Page

SYMPTOMS

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

CAUSE

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.

RESOLUTION

To allow programmatic access to the Visual Basic project, follow these steps, as appropriate for the version of Excel that you are running.

Excel 2007

  1. Click the Microsoft Office Button, and then click Excel Options.
  2. Click Trust Center.
  3. Click Trust Center Settings.
  4. Click Macro Settings.
  5. Click to select the Trust access to the VBA project object model check box.
  6. Click OK to close the Excel Options dialog box.

Excel 2003

  1. On the Tools menu, point to Macro, and then click Security.
  2. In the Security dialog box, click the Trusted Sources tab.
  3. Select the Trust access to Visual Basic Project check box.
  4. Click OK.

Properties

Article ID: 813969 - Last Review: January 13, 2007 - Revision: 4.2
APPLIES TO
  • Microsoft Office Excel 2007
  • Microsoft Office Excel 2003
Keywords: 
kbexpertisebeginner kbprogramming kberrmsg kbprb KB813969

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com