While working on the Microsoft Excel document it is likely to encounter a Compile error can’t find project or library Excel. Thus, if you are one such user, who is also facing the same error when using VBA for the Macros, keep on reading this post.
In this comprehensive post, you are going to learn how to fix Compile error in Excel macro using both manual as well as automatic solutions.
Quick Solutions |
Step-By-Step Solutions Guide |
Way 1- Look for Missing Reference |
Open Excel document >> press ALT and F11 keys on your keyboard…Complete Steps |
Way 2- Registering the Library File |
Go to the “Start” menu >> type “CMD” >> click on “Command Prompt (Admin)”…Complete Steps |
Way 3- Disable Missing Type Or Object Library Option |
Press the ALT and F11 keys on your keyboard to switch to the Visual Basic Editor…Complete Steps |
Way 4- Unregister & Reregister a Library |
Press the “Windows + R” keys >> type Regsvr32.exe…Complete Steps |
To repair corrupted Excel file data, we recommend this tool:
This software will prevent Excel workbook data such as BI data, financial reports & other analytical information from corruption and data loss. With this software you can rebuild corrupt Excel files and restore every single visual representation & dataset to its original, intact state in 3 easy steps:
- Download Excel File Repair Tool rated Excellent by Softpedia, Softonic & CNET.
- Select the corrupt Excel file (XLS, XLSX) & click Repair to initiate the repair process.
- Preview the repaired files and click Save File to save the files at desired location.
What Does Excel Can’t Find Project or Library Error Mean?
When Compile error: can’t find project or library occurs then it simply means that you can’t perform any operation in your Excel document that needs VBA. Below you can see the real interface of this Compile error:
In simple words, we can say, this error is faced by the users while using the VBA (Visual Basic Applications) for the macros to perform some assigned tasks.
How To Fix Excel Can’t Find Project or Library Error?
To fix Excel Can’t Find Project or Library error you have to search for the missing Excel VBA References and after that uncheck Excel references.
Way 1- Look for Missing Reference
The very first method that you should try to fix this error in Excel is to look for missing references.
Here are the complete steps to do this:
- Open your Excel application and then press ALT and F11 keys on your keyboard.
- On the opened VBA window go to the tools >> References dialog box.
- Choose the missing reference and then start your Object Browser.
- Use the Browse dialog box to make search for your missing reference.
- Hit the OK.
- Repeat the preceding steps until all missing references are resolved.
Also Read: [6 Fixes] Cannot Edit A Macro On A Hidden Workbook
Way 2- Registering the Library File
Installing any new software on your PC sometimes de-registers some specific libraries. In that case, registering the library file manually can help you to fix can’t find project or library VBA.
To do this, follow the below steps:
- On your Windows PC, go to the “Start” menu.
- Type “CMD” >> click on “Command Prompt (Admin)”.
- After this, click on “Run as Administrator”.
- Once a CMD window opens on your screen, you have to type the REGSVR32 “Path of a DLL File which you need to register”. (E.g.- REGSVR32 “C:\Program Files\Blackbaud\The Raisers Edge 7\DLL\RE7Outlook.dll”).
Doing this will help you to register the chosen library file without any error.
Way 3- Disable Missing Type Or Object Library Option
Commonly, the application has lost the reference to an object or type library resulting in the above error while using barcode macro and native VBA Functions.
To fix the Macros Compile error, follow the steps:
- Open the Microsoft Excel file that is giving you the error message.
- Make sure the Excel sheet or Datasheet that has the buttons or functions in question is selected.
- Simultaneously press the ALT and F11 keys on your keyboard to switch to the Visual Basic Editor in a new window (as seen below).
- In the new Visual Basic Editor window, click on the Tools menu at the top of the screen, and then click.
- A References dialogue box will display on the screen. A missing type or object library is indicated by “MISSING:” followed by the name of the missing type or object library (an example is MISSING: Microsoft Excel 10.0 Object Library, as seen below).
- If there is a checkmark in the checkbox next to the missing type or object library, then un-check the checkbox.
- Click OK > Exit the Visual Basic Editor.
- Save the original Excel file.
- Try using the buttons or functions in question that previously didn’t work and they should now work normally.
An alternative for removing the reference is to restore the referenced file to the path specified in the references dialog box. If the referenced file is in a new location, clear the “Missing: ”reference and create a new reference to the file in its new location.
Way 4- Unregister & Reregister a Library to Fix Compile Error Can’t Find Project or Library Excel
Many users have reported that they solved Excel compile error: can’t find project or library by unregistering & re-registering the library file.
For this, follow the below steps:
- First, press the “Windows + R” keys together to open Run box >> type Regsvr32.exe.
- After this press Enter & type the complete path of a missing/lost library file. (E.g.- “regsvr32 “c:\program files\common files\microsoft shared\dao\dao360.dll”).
Once you are done and if the error still persists then simply unregister a library file.
Here’s how to do so:
Replace the “Regsvr32.exe” with “regsvr32 -u” & paste a path of a library again.
Also Read: Fix VBA Error 400 Running An Excel Macro
How to Repair Corrupt MS Excel File?
The above-mentioned manual solution will most probably sort out the issues and mentioned errors from the Excel file. But for any other corruption or file damage most suitable option would be to make use of the MS Excel Repair Tool.
This is is highly competent in restoring corrupt Excel files and also retrieves data from worksheets like cell comments, charts, other data, and worksheet properties. This is a professionally designed program that can easily repair .xls and .xlsx files.
Steps to Utilize MS Excel Repair Tool:
Why Excel Is Showing Can’t Find Project Or Library Error?
- This error is usually caused by the user’s Excel program. The reason is that your program is referenced to such object or library which is missing. Due to which your Excel program is unable to find it. So the program is unable to use VB or Micro-based functions or buttons. This leads to an error message appearance.
- Since there are standard libraries so missing a library sounds like a bit of the last chance. Another reason for this, in that case, is that library miss-match occurs. For example, the user may have a library version of 2007 but the reference in the code may be looking for the 2010 version of that specific library. So the program fails to find the corresponding library thus issuing the compilation error.
- Sometimes a library may be toggled on or toggled off which causes a missing link issue between the library and program code. Therefore the compilation error occurs.
- Another reason for the error message is concerning the use of Microsoft XP which includes a reference to web service in the VBA project. When you run this project in MS Office 2003, the same compilation error appears. The reason is the same i.e. object or type of library is missing (or not found).
Conclusion:
Hope doing this will help you to fix the error Can’t find project or library Excel 2016, but if not then make use of the automatic third-party tool, this will help you to solve the error.
I tried my best to provide ample information about vba can’t find project or library errors and fixes.
However, if you are having any additional fixes or any queries then please share them with us.
Good Luck…