# Compile Error: Can't find project or library



## Dynamo2000 (Mar 2, 2003)

I have written numerous VB macros (subprograms) to facilitate operations in Excel. For months these macros ran without a hitch. Suddenly, I started getting this error message "Compile Error: Can't find project or library" when I try to execute some of these macros. When I click on the debug option it often points to a very simple assignment statement (often near the beginning of the macro) of the form: a=.... where a is previously undefined simple variable. My guess is there must be some simple switch or setting that I am unaware of and which got changed recently. Anyone know what the problem is and how to fix it?


----------



## Glaswegian (Dec 5, 2004)

Can you provide an example - in code? You mentioned an 'undefined variable' - if you've set Option Explicit on your code then VBA will highlight undefined variables. Always best to define your variables correctly.

Regards


----------



## Zinker1 (Feb 10, 2006)

I have the same problem with Excel. The solution I found was posted at:

http://support.microsoft.com/kb/q208218/

The essential bits are reproduced below (they seem to have worked for me).

----------------

Your database contains a reference to a database, type library, or object library that is marked as MISSING: <referencename> in the References dialog box.

To remove the missing reference, follow these steps: 1. Open your database. 
2. Press ALT+F11 to switch to the Visual Basic Editor. 
3. Open a module in Design view. 
4. On the Tools menu, click References. 
5. Click to clear the check box for the type library or object library marked as MISSING: <referencename>.


----------



## Zack Barresse (Jul 25, 2004)

As Zinker described, this is how to get rid of MISSING type libraries within Excel. The underlying problem is what you're after. When opening a file (we'll assume it's Excel), the references need to be made in the earliest version being used. When this file is loaded into a newer version, the references will update to the currently employed version/instance.

Now take that same file and try to open it in an earlier version, what happens? Poof, MISSING error, because you're trying to use a 11.0 or 10.0 reference in a 9.0 (or similar) version. Multi-version development is a serious issue. It's generally recommended to develop in the earliest version used with the application to avoid any failures (like these).

HTH


----------

