How to Fix the 'Can't Find Project or Library' VBA Error in Excel
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.

- 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 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.
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.
Open your affected workbook in Excel and press Alt + F11 on your keyboard to launch the Visual Basic Editor (VBE).
In the top menu bar of the VBE, click on Tools and select References from the dropdown menu.
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.
Click on Debug in the top menu and select Compile VBAProject. If no error messages appear, the compilation is successful.
Save your workbook, close the Visual Basic Editor, and run your macro again to confirm it executes without the error.

Manually Locate or Register the Required Library
Use this method if unchecking the missing reference causes a new compilation error, meaning your macro explicitly relies on that specific library.
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.

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.




