Can't Find Project or Library; also can't access VBA Codes or "References"

jewkes6000

Board Regular
Joined
Mar 25, 2020
Messages
55
Office Version
  1. 365
Platform
  1. Windows
I have a .xlsm file with a ton of macros. One of my co-workers was using it and suddenly started getting the "Can't Find Project or Library" error. I've researched on the internet and a common solution is to go into the VB editor and check the references; however, I can't even access the reference box. Whenever I open the VB Editor (Alt+F11), I can do anything in the editor. I can select "Tool" then "References"; however, nothing happens when I click it. Further, when I open up a module, I can't see my code. I've attached a screenshot of what this looks like. It's just a blank screen.

A couple things to note:
- It only happens with this Excel file. Other macro enabled files work fine
- With this file, we gate the same issue on both mine and my co-workers computer.
- I've also tried registering a library file by using the run command as explained in the link below, but that didn't work either.
- When I click on a UserForm in the VB Editor, I get an error which says "Module not found" (see 2nd screenshot below)

Any suggestions or help is much appreciated.

Thank you.

1613779443920.png



1613779485611.png
 

Some videos you may like

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

diddi

Well-known Member
Joined
May 20, 2004
Messages
3,267
Office Version
  1. 2010
Platform
  1. Windows
damaged file or damaged excel install i am thinking
 

sitewolf

Active Member
Joined
May 4, 2012
Messages
291
I've run into this and resolved it in various ways before....including Tools/References in the VB editor and turning OLE Automation off, save and close, then reopen the file....or copying the VB code from modules into a new file.

But the reason I came here today is because I keep running into this, on multiple files and on multiple devices (not all at the same time, just happens to one periodically)
So MY question is.......why does it keep happening when it's on multiple installs and devices?
For the most part, the macros are still in the editor, I just can't run them.
These are mostly files created sometimes quite a few years ago....has VB code changed and my old coding just starts breaking?
 

jewkes6000

Board Regular
Joined
Mar 25, 2020
Messages
55
Office Version
  1. 365
Platform
  1. Windows
I never found a good reason as to why this happened; however, thus far, it has only happened to one of my colleague (it has hasn't happened to me, although, when it happens to her, that same file doesn't work on my computer either). I think my colleague's computer is not properly linked to Sharepoint and when it's looking for some linked files, I think that's when it happens???? This is just a wild guess.

One way that I have found which fixes it is to us the repair function in Excel. Open Excel, then click, File, Open and browse to the corrupt file. Click the file and the click the down arrow next to the "Open" button and select "Open and Repair...". This has been working for me whenever it has happened to my colleague.
 

ZVI

MrExcel MVP
Joined
Apr 9, 2008
Messages
3,817
Office Version
  1. 2016
  2. 2010
  3. 2007
Platform
  1. Windows

ADVERTISEMENT

Can try to recover the VBA project of that workbook if you PM me link to download it (you may delete all data sheets except of empty one).
To be sure it is your code, do you have previous copy of workbook which is working, or some code from that XLSM?
 

Robert1217

New Member
Joined
Mar 23, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Hi all,

The same here.

I am building large *.xlsb/*.xlsm Excel models including the use of Power query / Power pivot and obviously, VB macros.
Sometimes when opening a file, Excel gives me the “Can’t find project or library” message as well.
When the error occurs, macros can’t be accessed anymore and Excel is crashing soon after, so figuring out what could have caused this (when the particular file has opened) isn’t possible either.

I am working as a contractor for companies which employ hundreds of Excel co-workers and have seen this on various (modern) laptops.

In my experience, this error usually appears on the laptop which the file is saved the last time and I therefore don’t quite understand how appropriate the MS-suggested solutions are (checking/unchecking references dialog boxes etc.) as the file opens perfectly on another machine with exactly the same references checked/unchecked indeed.

The error therefore seems somehow related to the particular file in combination with the hardware on which the file is saved, rather than just the Excel program itself.

Further, the issue doesn’t seem to be related to old/new/32-bit/64-bit etc. laptops, nor the amount of RAM nor types of processor nor VBA/references settings.

Local IT departments / MS consultants don’t have a clue (“what are you talking about, file opens fine over here”…) and I remain very curious what could prevent this from happening in the first place.

Thanks!
 

jewkes6000

Board Regular
Joined
Mar 25, 2020
Messages
55
Office Version
  1. 365
Platform
  1. Windows
@*Robert1217 - For me, the issue was just one person and I believe it has something to do with their connection to Sharepoint or OneDrive or some kind of cloud service. The solution that worked for us is the following:
  1. Open Excel (don't open a file through File Explorer)
  2. Click "Open File" and browse to the file you're having the issue with
  3. In the bottom right-hand corner where it says "Open", click the down arrow just to the right of this Open button
  4. Select "Open and Repair..."
This repaired the file so it was usable. Still unsure what is causing the issue. Make sure they are logged into all of their cloud accounts. Other than that, I'm not sure. I'm no expert in this area.
 

Watch MrExcel Video

Forum statistics

Threads
1,127,404
Messages
5,624,563
Members
416,035
Latest member
GISperson

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top