XL: Error Running Macro with Reference to XLODBC.XLA File

Last reviewed: February 27, 1998
Article ID: Q151544
The information in this article applies to:
  • Microsoft Excel for Windows 95, version 7.0
  • Microsoft Excel 97 for Windows

SYMPTOMS

When you run a procedure from a module that contains a reference to the Xlodbc.xla file, you may receive the following error message:

     Attempt to register Xlodbc32.dll failed.

In Microsoft Excel 97, you may receive this error as soon as you open the workbook that contains a reference to Xlodbc.xla.

MORE INFORMATION

This error occurs when all of the following are true:

  • Both Microsoft Excel version 5.0 and Microsoft Excel version 7.0 or 97 are installed in separate folders on the same computer.

        -and-
    
  • A file created in Microsoft Excel version 5.0 contains a Visual Basic for Applications procedure calling SQL functions from a module with a reference to the Microsoft Excel version 5.0 file Xlodbc.xla.

        -and-
    
  • The procedure is being run from Microsoft Excel version 7.0 or Microsoft Excel 97 on the same computer where Microsoft Excel 5.0 is installed.

The error message, "Attempt to register XLODBC.DLL failed." may also occur if a procedure with a reference to Xlodbc.xla created in Microsoft Excel version 7.0 or 97 is run from Microsoft Excel version 5.0 on the same computer.

CAUSE

When you establish a reference to another workbook or library, Microsoft Excel hard-codes the path of the file when the reference is established. The error occurs because the path to the Xlodbc.xla file is still valid, and Microsoft Excel attempts to open the incorrect Xlodbc.xla file.

The error does not occur if only one version of Microsoft Excel is installed on the computer. Instead, if the file cannot be found, you may receive the following error message:

     Can't find project or library.

See articles referenced later in this article for more information about this error.

RESOLUTION

Microsoft Excel 7.0

With your module sheet active, click References on the Tools menu, click to clear the current reference, and use the Browse option to establish a new reference to the correct Xlodbc.xla file. After establishing the correct reference, save and close the file, and then restart Microsoft Excel.

Microsoft Excel 97

Press ALT+F11 to activate Visual Basic Editor. Click References on the Tools menu, click to clear the current reference, and use the Browse option to establish a new reference to the correct Xlodbc.xla file. Click Close and Return to Microsoft Excel on the File menu. Save and close the file, and then restart Microsoft Excel.

For additional information, please see the following articles in the Microsoft Knowledge Base:

   ARTICLE-ID: Q124277
   TITLE     : XL5 Err Msg: "Can't Find Project or Library" Running
               Macro

   ARTICLE-ID: Q131298
   TITLE     : XL5 How to Avoid the Error "Can't Find Project or
               Library"

REFERENCES

"Visual Basic User's Guide," version 5.0, chapter 4, "Organizing Procedures and Modules in Workbooks"

For more information about calling procedures in other workbooks, click Microsoft Excel Help Topics on the Help Menu, click the Index tab and type:

    Calling procedures


Additional query words: 5.00 5.00a 5.00c 7.00 7.00a 8.00 97
Keywords : kberrmsg kbprg
Version : WINDOWS:7.0,97
Platform : WINDOWS


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: February 27, 1998
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.