logo
search
VBA & Macro Problems

How to Fix the 'Can't Find Project or Library' VBA Error in Excel

Elise WilliamsElise Williams Sep 27, 2026 869 views

Question details

The user needs to fix a compilation error that stops an Excel macro from running due to unlocated project libraries or VBA references.

How to Fix the 'Can't Find Project or Library' VBA Error in Excel
Product
Microsoft Excel
Device & OS
Windows
Scenario
Running a VBA macro after transferring an Excel workbook to a different Windows device.
Observed behavior
Excel halts macro execution and displays a 'Can't find project or library' error message because the new environment lacks specific reference libraries.
Before you start

Before modifying your VBA references, save a backup copy of your Excel workbook (.xlsm) to prevent any accidental loss of your macro code during the compilation process.

Solution 1Recommended

Clear Missing References in the Visual Basic Editor

This is the most common fix. Unchecking libraries that are marked as missing will resolve the error if your macro code does not actually require them.

When a workbook is moved between devices with different software versions, Excel may look for object libraries that do not exist on the new PC. Removing these broken links often restores macro functionality.

1
Open the Visual Basic Editor

Open your affected workbook in Excel and press Alt + F11 on your keyboard to launch the Visual Basic Editor (VBE).

2
Access the References dialog

In the top menu bar of the VBE, click on Tools and select References from the dropdown menu.

3
Uncheck missing libraries

Scroll through the list of Available References and locate any items that have the word 'MISSING:' prefixing their name. Clear the checkbox next to these items.

4
Compile the VBA project

Click on Debug in the top menu and select Compile VBAProject. If no error messages appear, the compilation is successful.

5
Save and test the macro

Save your workbook, close the Visual Basic Editor, and run your macro again to confirm it executes without the error.

Clear Missing References in the Visual Basic Editor
Success Tip: If the Compile VBAProject option is grayed out, it means your code is already successfully compiled and contains no syntax or reference errors.
Free Microsoft Office alternative

Experience Seamless Spreadsheet Compatibility with WPS Office

Dealing with missing VBA libraries and complex macro errors when switching computers can disrupt your workflow. Try WPS Office as a free, lightweight alternative. It offers excellent format compatibility and a familiar interface, making it easy to migrate your workbooks and continue working without heavy resource usage or constant troubleshooting.

Completely free and lightweight alternative to Microsoft ExcelHighly compatible with standard .xls, .xlsx, and .csv file formatsFamiliar user interface ensuring a seamless transition with no learning curveSupports essential spreadsheet functions, pivot tables, and daily data processing needs
microsoft office alternative - wps office

Frequently Asked Questions

Why does Excel show the 'Can't find project or library' error?

This error occurs when a macro references an external object library, application, or file that is not installed, has been moved, or is a different version on your current Windows device.

How do I know which VBA reference is causing the error?

Open the Visual Basic Editor (Alt + F11), click on 'Tools' in the top menu, and select 'References'. The problematic reference will clearly have the word 'MISSING:' prefixed to its name in the available list.

Will unchecking a missing reference break my macro?

If the macro does not actually use the specific objects or functions provided by that library, unchecking it will solve the error instantly without breaking anything. However, if the code relies on it, you will receive a new compilation error and must manually install or locate the library on your PC.

Does this error only happen when moving workbooks to another computer?

While it is most common when transferring files between devices with different software environments, it can also happen on the same PC if you uninstall a referenced program, move a system file, or upgrade your Office version.