“Can’t find project or library” is usually a VBA compile error caused by a missing, broken, or incompatible reference in the workbook or other Office file. In the Visual Basic Editor, open Tools > References, look for an entry marked MISSING, then restore the required library or remove the reference only if the project no longer needs it.
What the error means
A VBA project can refer to code and types supplied by other components, called libraries. A reference tells the editor where to find those components and lets VBA recognize their objects, functions, constants, and data types. When a referenced library is unavailable, VBA may stop compiling the project and report that it can’t find the project or library.
The message can be misleading: VBA may highlight an ordinary-looking word in a line of code rather than the missing component itself. For example, a variable declaration using a type from an unavailable library may be underlined, even though the actual problem is the reference that defines that type. The error does not necessarily mean the workbook is damaged, nor does it usually mean the VBA project has disappeared.
This issue can occur in Excel, Access, Word, Outlook, and other Office programs that host VBA. The exact libraries available depend on the program, installed Office components, Windows or Mac, and other software on the computer.
Why a VBA reference goes missing
A project’s references are recorded with the file, but the referenced component must also be available on the computer that opens it. Common causes include moving a workbook to a computer without the same add-in or third-party program, uninstalling a component, changing Office versions, or receiving a file created on a different operating system.
- Uninstalled software: A project may refer to a library installed by an application that has since been removed.
- Different Office or Windows setup: A reference may point to a particular version of an Office library or a Windows component that is absent on another system.
- 32-bit and 64-bit differences: A dependency, especially an external component or API declaration, may not be compatible with the installed Office architecture.
- Broken installation or registration: A library file may exist but no longer be registered correctly with Windows.
- Unsuitable platform: A Windows-only component, such as an ActiveX control, may not be available in Excel for Mac.
These causes are distinct from macro security settings. Trust Center settings can prevent macros from running, but changing them does not supply a missing library. Likewise, Excel for the web can open a workbook containing macros, but it cannot run or edit VBA; use the desktop Excel application for VBA troubleshooting.
How to find the missing reference
In Excel for Microsoft 365 on Windows, open the workbook in desktop Excel and press Alt+F11 to open the Visual Basic Editor. On a Mac, use Option+F11; depending on the keyboard, you may need Fn as well. In the editor, select the relevant project in Project Explorer, then choose Tools > References. If the project is locked or unavailable, you may need permission from its owner before you can inspect its references.
- Read the list of references and look for a checked item beginning with MISSING:.
- Note the full name of the missing item before changing anything. It can identify the application or component the code expects.
- Close the dialog with Cancel if you are unsure what the reference is for; first identify the dependency or ask the workbook’s author.
- After making a change, use Debug > Compile VBAProject (the project name can differ) to check whether the project now compiles.
Do not assume that the first word highlighted by the error is the missing reference. A compile check is useful because it can reveal another problem after the first one is fixed. If the References command is unavailable, make sure a VBA project is open and selected; in a protected or managed file, the project owner or administrator may have restricted access.
Fix the reference without breaking the project
The safest fix is to make the expected library available again. If the reference belongs to a required application or add-in, install or repair that component using its legitimate installer, then reopen the Office file. For an Office library, confirm that the relevant Office application or feature is installed. If the file came from someone else, ask which component and version the project requires rather than downloading a similarly named DLL from an unknown site.
If the reference is genuinely obsolete and the project no longer uses it, clear its checkbox in Tools > References and compile again. Be cautious: code may depend on the library even if the missing reference is not obvious. A project using a library’s object types, named constants, or functions will produce further compile errors when that reference is removed. Restoring the intended dependency is preferable to deleting a necessary reference merely to make the warning disappear.
When a required component is already installed but still appears missing, close and reopen the Office application, check for the component’s repair or registration instructions, and verify that the correct version and architecture are installed. For Microsoft 365 on Windows, repair Office from Windows Settings > Apps > Installed apps: select Microsoft 365, choose Modify, and try Quick Repair first. Online Repair is a more extensive option and may require signing in or reinstalling components. Menu labels can vary slightly by Windows release and organization policy.
Identify what the project depends on
The name after MISSING: is a useful clue. For instance, a missing Microsoft Outlook Object Library may indicate code that automates Outlook, while Microsoft Scripting Runtime is commonly associated with objects such as FileSystemObject or Dictionary. A missing ADO library can point to database access code. These examples identify likely dependencies, not a guarantee that a particular program version is required; inspect the code and check with its author before installing or removing anything.
If the project is yours, search its modules for distinctive object names, types, and constants associated with the missing library. Also review the workbook’s documentation and any setup notes. A reference to a library that the code never uses may be leftover from an earlier version, but only a successful compile and appropriate functional checks can confirm that removing it is safe.
Do not substitute a different library just because its name looks similar. Different versions can expose different types or behavior. Nor should you browse to an arbitrary DLL to satisfy the dialog: a library needs to be compatible and properly installed, and an untrusted file can create security and stability risks.
Version, architecture, and Mac compatibility
A workbook that works on its creator’s computer may fail elsewhere because references are not always portable across installations. Office’s built-in object libraries are usually present with the corresponding Office application, but third-party libraries and Windows components may not be. A project that references an exact version of a library can also run into trouble when a computer has a different version installed.
Windows Excel can use Windows-specific components that are unavailable in Excel for Mac. A Windows reference may therefore be impossible to restore on a Mac, even if the workbook itself opens. If a file must work on both platforms, its author may need to remove the platform-specific dependency or provide separate implementations. Excel for the web is more limited still: it does not execute VBA macros, so it is not a way to test whether a VBA reference has been fixed.
Office bitness matters most when code interacts with external libraries, controls, or Windows API declarations. A reference or declaration built for 32-bit Office may not work unchanged in 64-bit Office. The missing-reference dialog is not, by itself, proof of a bitness problem; first identify the named library, then check that component’s requirements and the Office installation’s architecture.
Common mistakes and safe troubleshooting
Removing every item marked MISSING is not a reliable general fix. It may clear the initial message while leaving code unable to compile or behave correctly. Similarly, changing macro security, repeatedly pressing Run, or reinstalling all of Office before checking Tools > References is unlikely to address the underlying cause.
- Save a separate copy of the workbook before changing its VBA project, especially if it contains important business logic.
- Record the missing library’s name and the computer or Office version where the file worked.
- Change one reference at a time, then compile and test the relevant features.
- Use a trusted installer or the organization’s software support team to restore dependencies.
- If the project belongs to an employer or client, ask its owner before altering references or distributing a modified copy.
VBA changes to a workbook are not undone with Ctrl+Z, so a backup matters even when the proposed change seems small. If the code belongs to a vendor product or signed project, changing it can also affect support or signature status. In that case, have the vendor or project owner provide a compatible version instead of editing the dependency list yourself.
Frequently Asked Questions
How do I fix “Can’t find project or library” in Excel?
Open the Visual Basic Editor with Alt+F11, choose Tools > References, and identify any checked item marked MISSING. Restore the required component, or clear the reference only if you have confirmed that the project no longer uses it. Then choose Debug > Compile VBAProject.
Why does VBA highlight a word that is not a library name?
The highlighted word may be a type, constant, or procedure that depends on the unavailable library. VBA can report the error at the point where it encounters an unknown identifier, rather than at the reference entry that caused the problem.
Can I just uncheck the missing reference?
Only if the project no longer needs it. If the code uses the library, unchecking it can lead to compile errors or broken features. Make a backup and compile after the change, and restore the correct dependency if the project relies on it.
Does this error mean macros are disabled?
No. A disabled macro is a security or policy issue; a missing reference means VBA cannot locate a component needed to compile the project. Enabling macros will not install or repair that component.
Can I fix this in Excel for the web?
No. Excel for the web does not run or edit VBA. Open the workbook in desktop Excel for Windows or Mac, noting that a Windows-only library may still be unavailable on a Mac.
When to ask for help
If the missing item is a third-party component, the workbook is protected, or the file must work across Windows and Mac, contact its author, vendor, or IT administrator with the exact MISSING: entry and your Office version and bitness. Those details help distinguish a missing installation from an incompatible project and reduce the risk of removing a dependency the code actually needs.
Related
- Excel Table Dropdown List: Create and Manage Lists
- Excel Tab Shortcut Keys: Move Between Worksheets
- Excel Stop Showing Page Break Lines: Fixes
Try it: the Column Letter to Number: aA is 27, XFD is 16,384. Converts both ways.
More in VBA & macros
- Excel VBA Filter Function: Syntax, Examples, and LimitsIn Excel VBA, the Filter function searches a one-dimensional array of strings and returns the elements that contain…
- VBA Check If Worksheet Exists: Code and ExamplesTo check whether a worksheet exists in VBA, try to set a Worksheet variable from the target workbook’s…
- Excel VBA: How to Check Whether a Workbook Is OpenTo check whether a workbook is open in Excel VBA, loop through Application.Workbooks and compare each open workbook’s…
- VBA Range in Excel: How to Reference CellsIn Excel VBA, a Range is an object that represents one cell or a group of cells. To…
- VBA Error Handling Tutorial: Errors, Handlers, and CleanupVBA error handling lets a macro respond to a runtime problem instead of stopping unexpectedly. Start with On…
- Excel VBA: Copy and Paste Selected Cells with a MacroTo copy selected cells with VBA, call the range’s Copy method and specify a destination cell, as in…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.