Error message when you cancel the installation of Visual Basic for Applications: "An error occurred"

Applies to: Microsoft Office Excel 2007

Symptoms


If you cancel the installation of Microsoft Visual Basic for Applications (VBA) in Microsoft Excel, you may receive an error message that is similar to the following:
An error occurred initializing the VBA libraries (1004)

Cause


This behavior can occur when all of the following conditions are true:
  • If VBA is set to install on first use when you install Excel or Microsoft Office.

    -and-
  • You have not yet used VBA in this installation of Excel or Microsoft Office.

    -and-
  • You press ALT + F11 to open Visual Basic Editor, and then click No when prompted to install VBA.

Resolution


To prevent this issue from occurring, follow these steps to install VBA:
  1. Start Excel.
  2. You press ALT + F11 to open Visual Basic Editor.
  3. When prompted to install VBA, click
    Yes.