BH57
BH57

Reputation: 291

References in VBA editor not opening

I am getting an error saying "Can't find project or library" error message when I try to run a VBA project. I am trying to go into the References to see if there is something there that is causing an issue, but when I click on it, it does nothing.

Any suggestions?

Upvotes: 10

Views: 44981

Answers (11)

Tripti Sinha
Tripti Sinha

Reputation: 1

Try run->reset, then check for references again.

Upvotes: -1

Fuad
Fuad

Reputation: 11

I managed to get a workaround for this error.

I was working off of an excel file (macro-enabled workbook) that was stored in my OneDrive, via the desktop interface when this morning. When I opened the file this morning I was suddenly greeted by the "Can't find object or library" error.

To fix it:

  1. I opened the file via the OneDrive web interface
  2. This invoked the Excel web interface
  3. Within the Excel web interface, used the Save As feature to save a version of the file to my computer
  4. Voila! When I open the new xlsm file on my computer, the error is no more!

This might not work for everyone, but I thought I'd put it down here just in case someone had the same cocktail of circumstance.

Upvotes: 1

WoolyFox
WoolyFox

Reputation: 35

Same error as user, script and file were working fine beforehand but today no dice. Using AVB's answer but expanded for clarity.

  • Open a blank excel sheet and disable Macros and close.
  • Open the problem file in safe mode (hold control after double clicking file).
  • Open Developer tab and VBA, in VBA open the Debug Menu and click'Compile VBAProject', save the file and close.
  • Open same file in normal mode (not holding control) and re-enable Macros and test to see if working as before

Upvotes: 1

eroock
eroock

Reputation: 1

What worked for me:

  • open a blank excel file
  • go into VBA and disable Microsoft Office 15.0 Object Library (might be a different one for you)
  • Close Excel
  • Reopen and active Microsoft Office 15.0 Object Library

Upvotes: 0

AVB
AVB

Reputation: 11

After opening in Safe Mode, go in to VBA and under Debug -> Compile VBA Project

Upvotes: 1

Sharan Nair
Sharan Nair

Reputation: 31

This worked for me - a. Copy/paste the problematic file to a new location. The error seems to be resolved in the file in the new location. b. Delete the problematic file in the original location (optional) c. Copy/paste the corrected file back to the original location.(optional)

Upvotes: 3

kristiantonev
kristiantonev

Reputation: 31

I also managet to fix it by disabling all macros, saving the file, and then enabling them from the "Macro Security" in the Developer tab.

Upvotes: 3

Scott Ayers
Scott Ayers

Reputation: 1

I just fixed this issue by getting somebody else on the network in my office to go into the file (which worked for them), then saving it as a trusted file. I suppose this would work by emailing a copy of the file to a different device and going into it on there. While on the different device you can also go into VBA Editor > Tools > References then untick all that aren't necessary. This may or may not be necessary. More technical solutions may be available but this seems to be a simple one that worked for me.

Upvotes: 0

BuhBlake
BuhBlake

Reputation: 25

This can happen for any number of reasons, as VBA and excel are very sensitive. What i would suggest is unprotecting your workbook in any way that it is protected for now. Then try accessing your file via "safe mode" by holding ctrl when opening excel. Take the time to back up any important VBA codes. If you can't fix the errors in safe mode you may need to recreate the workbook with the saved VBA codes.

Also if you have a personal XLSB workbook it may have been corrupted. Go to your excel's XLSB file location and check by opening it and seeing if there are any issues.

I recently had this issue because i protected a sheet that VBA was trying to access when running a code so make sure everything is in order of when it was last working.

Upvotes: 1

coolactuary
coolactuary

Reputation: 53

This has happened to me twice in the last week. For me not only did nothing open under "tools / references" but although the VBA modules were visible they were completely empty. I don't know the cause, but I speculate that it is some combination of:

  • The Power Pivot addin (I'm using Office 365 FWIW)
  • Dax Studio (this was present second time but not first)
  • The MS scripting runtime reference/library

The first time I managed to retrieve the situation, through a complex procedure; I'm not sure what part of the process worked the magic and for me it's not replicable. The second time (this morning) I adopted a simpler procedure.

  1. I did the Office repair. That didn't work for me either.
  2. I opened an empty .xlsm and went into the VBE.
  3. I added a reference to the scripting runtime (Tools/References behaved as expected)
  4. Leaving this empty .xlsm open I opened the s/sheet that was giving me the problem.
  5. Voila: I got all my VBA back, Tools/References is OK.

Happy bunny - for now.

Upvotes: 2

Leonardo Fernandez
Leonardo Fernandez

Reputation: 3

This has happened to me before. As usual, I'd suggest restarting Office. If that does not work, then go to Control Panel> Uninstalled Software> Microsoft Office. click on "Modify" and then once the wizard comes up, select "Repair".

Upvotes: 0

Related Questions