Microsoft Visual Basic For Application Can’t Find Project Or Library
The VBA error “Can’t find project or library” means your project has a reference that Office cannot resolve. Open the Visual Basic Editor, choose Tools > References, and check for entries labelled MISSING. Restore any library the code needs, or remove an unused reference, then.
Which licences fit your PC setup?
Prices are an AUD snapshot, not a live quote. Confirm variant and total on the listing.
-

Windows 11 Pro key
$14.99 AUD
$29.00 -

Office 2024 Pro Plus key
$20.00 AUD
$39.00 -

Windows 11 Home key
$18.88 AUD
$37.00
What the error tells you
A reference connects a VBA project to another project or an object library. For example, an Excel macro that controls Word may depend on Word’s object library. If the referenced component is unavailable on the computer opening the file, VBA cannot resolve that dependency.
This often becomes apparent after moving a workbook or document to another computer, removing supporting software, or changing the Office installation. The error identifies a dependency problem; it does not automatically mean that your document is damaged.
Microsoft’s guidance on missing projects and libraries explains that missing references must be resolved before the code can run. Start with the reference list rather than rewriting the line where execution stopped.
Find the missing reference
Save a backup before changing the project. The following steps apply to desktop Office on Windows; keyboard shortcuts and menus can differ on other platforms.
- Open the affected workbook, document or database in its Office application.
- Press Alt+F11 to open the Visual Basic Editor.
- In Project Explorer, select the project belonging to the affected file. If several files or add-ins are open, check that you have selected the right one.
- Choose Tools > References.
- Inspect the selected entries for a MISSING prefix. Select each missing entry and record its name and the location shown in the dialogue box.
- Use that information to determine which application, add-in or custom component supplies the library.
If the project is locked and you cannot inspect it, ask its author or maintainer to check the references. Give them the exact error message, the affected file and details of any recent software changes.
Choose the appropriate repair
Remove a reference only when it is unused
A project can retain references from features that were removed during development. If a missing library is no longer needed, clear its checkbox and select OK. Microsoft’s References dialogue documentation recommends clearing references to libraries whose objects are not used.
Compile the project afterwards. If compilation now reports an undefined type or another dependency error, investigate whether the removed library supplies that type. Removing a required reference does not replace its functionality.
Restore a library the code needs
If the component is installed, check whether the correct library appears in Available References. Select it and confirm the change. If it is absent from the list but you know the correct file location, use Browse to locate it. Microsoft describes this process in its instructions for adding an object library reference.
If the supplying application or component is absent, install it using its supported installer. For a workplace macro, ask the maintainer which package and version it requires. Use the vendor’s installation or repair process when component registration is necessary; selecting a file through Browse is not the same as registering it.
Avoid choosing a library solely because its name looks similar. A replacement must provide the objects and members used by the code. After adding the correct reference, remove any obsolete missing entry that it replaces.
Check compatibility after an Office change
Compare the working and failing computers’ Office versions, Office architecture and installed dependencies. A newer library is not automatically a suitable replacement for the one the project expects.
Office architecture matters for components loaded into the Office process. As Microsoft’s 32-bit and 64-bit compatibility guidance explains, a 64-bit Office process cannot load a 32-bit binary. An older ActiveX control may therefore need a compatible replacement from its vendor.
If your search leads to instructions on adding Visual Basic PowerPacks to the Toolbox, check the development environment those instructions concern. A Visual Basic Toolbox procedure is not a general repair for a missing Office VBA reference.
Compile and test the repaired project
- Return to the Visual Basic Editor and select the affected project.
- Choose Debug > Compile VBAProject, or the equivalent Compile command showing your project’s name.
- Resolve any remaining compilation errors, checking References again if another dependency is reported.
- Save the file in a format that preserves its VBA project.
- Close and reopen the file, then test the affected macro using a copy of your data.
Successful compilation checks the code’s compile-time requirements. Testing still matters because external applications, files or services may be needed only when a particular procedure runs. If you are learning how macros are organised, the guide to subroutines in Visual Basic explains the procedure structure you will encounter.
If the error remains
Check whether the error affects one file or appears when Office starts without that file. An add-in or another loaded project may need attention. Ask its maintainer to inspect its dependencies, especially if its code is protected.
Consider repairing the supplying application when a required component should be installed but is unavailable. Repairing Office is relevant when Office’s own components are affected; it will not install an unrelated third-party library.
Macro permissions are a separate issue. Enabling all macros does not restore a missing library. If a security message also appears, address that message through your organisation’s approved process.
Reduce dependency problems when sharing macros
Keep a record of required libraries, their supplying software and compatible Office environments. Remove unused references and test on the recipient’s setup before distributing the file. The Visual Basic guides provide further background for maintaining the code.
For suitable Automation code, a developer can consider late binding. Microsoft’s explanation of early and late binding describes how late binding avoids a compile-time type-library reference for supported objects. It still requires the underlying software and needs testing; changing declarations alone may leave library-specific constants or other dependencies unresolved.
Start by backing up the affected file and recording the first MISSING entry in Tools > References. Use its name and location to identify the component that needs restoring.
Other editions for separate workloads
Other editions for separate workloads; prices in AUD, confirm the total on the listing.
-

Windows 10 Pro key
$12.00 AUD
$15.00 -

Microsoft 365 Pro Plus, 5 devices
$15.00 AUD
$29.00 -

Windows Server 2022 Standard
$120.00 AUD
$239.00
How to check this worked
- Open Settings, System, Activation and confirm the edition shown.
- Enter the key and run activation; expect a green tick within a minute.
- Reboot and re-check activation survives the restart.
FAQ
What else should you know before buying?
- What do I need before starting?
- Read the requirements and confirm the edition first; the steps assume the machine is compatible.
- How do I know the licence is genuine?
- Activate on Microsoft's servers and check Settings, System, Activation. A working activation is the test.
- Is this a subscription?
- Keys sold here are one-time lifetime licences. Microsoft 365 plans are billed by Microsoft instead.
- What if the key fails?
- Email hi@ms.codes with the order number and a screenshot. Replacement or refund applies within 30 days.
Check who prepared and reviewed this guide
- Written by
- MS.Codes editorial
- Reviewed by
- Support team
Last verified: (source review; see test status above).