XL97: Compile Error Running Recorded Macro That Uses Solver

Last reviewed: March 13, 1998
Article ID: Q171750
The information in this article applies to:
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you run a Visual Basic for Applications macro that you created by using the macro recorder, you may receive the following error message:

   Compile error:
   Sub or Function not defined

CAUSE

The problem occurs when you run a recorded a macro that uses the Solver add- in and you do not reference the Solver add-in.

RESOLUTION

To resolve the problem, create a reference to the Solver add-in. To create a reference to the Solver add-in, follow these steps:

  1. Start the Visual Basic Editor (press ALT+F11).

  2. On the Tools menu, click References.

  3. Select Solver.xla, and then click OK.

    NOTE: The Solver.xla file is located in C:\Program Files\Microsoft Office\Office\Library\Solver.

The next time you run the macro, this problem does not occur.

STATUS

This behavior is by design of Microsoft Excel.

REFERENCES

For more information about using references, click the Office Assistant in the Visual Basic Editor, type "references," click Search, and then click to view "Set a Reference to a Type Library."

NOTE: If the Assistant is hidden, click the Office Assistant button on the Standard toolbar. If Microsoft Help is not installed on your computer, please see the following article in the Microsoft Knowledge Base:

   ARTICLE-ID: Q120802
   TITLE     : Office: How to Add/Remove a Single Office
               Program or Component


Additional query words: XL97 solver.xla
Keywords : kbprg kbtool
Version : WINDOWS:97
Platform : WINDOWS
Issue type : kbprb
Solution Type : kbworkaround


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: March 13, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.