0

Using Office 2016. I have an Excel file with VBA. Whenever I open it, I get the error "Can't find Project or Library". Excel immediatlely closes.

I opened Excel and, without opening the file, looked at References. There was one labeled "UNSAVED: VBA Project". When I tried checking it, I got an error. (Sorry, I don't remember exactly what it said -- something about having to save it when the file was open.)

Since the, the "UNSAVED: VBA Project" has stopped appearing. There are no entries that say "MISSING".

Open-and-Repair (on the real version) causes the same crash. Opening in Safe Mode doesn't help the issue. However, I can open it in Protected View without its crashing.

I saved a copy without VBA and it worked.

ADDITIONAL: There's a pivot table in the workbook that's connected to an external database.

There's also a Workbook_Open macro that asks the user if he/she wants to run a second macro that updates the pivot table. However, when I block the macros from running, the file still crashes without the Workbook_Open, so the pivot table never tries to update.

3
  • Does your code interact with other applications like Outlook, Word or Powerpoint? Commented Oct 22, 2019 at 6:56
  • 1
    Please Edit your post and upload the VBA code you have used so far, help us to fix the issue !! Commented Oct 22, 2019 at 7:53
  • @MarkFitzgerald Sort of. See my edits. Commented Oct 22, 2019 at 14:30

3 Answers 3

0

I seem to have found a workaround. At some point, when I opened the file in Protected View, I was still able to go to the Visual Basic editor and see its modules. I exported them.

As I said, I had saved a copy as an xlsx file (without the VBA modules). I imported the modules into this version and saved it as xlsm. This version seems to have no problems.

0

I get this error often for one of my large files. There is no "MISSING" reference shown. The only fix is to have a coworker open the file, enable content and save out the file again.

0

When all else failed, this worked for me. I opened my workbook in Excel online (Office 365, in the browser, which doesn't support macros anyway), saved it with a new file name (still using .xlsm file extension), and reopened in the desktop software. It worked.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .