Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

'File Not Found: VBA6.dll' Error - Strange Behaviour

Tags:

excel

vba

dll

I am running Windows 8 with Office 2013 (64-Bit). I am trying to continue developments in VBA in Excel that I started with Office 2010 (32-Bit). I am aware of the necessary 64-Bit alterations however I am receiving confusing configuration errors.

Here is the problem:

  • If I create a new Excel file and VBA project; all my VBA code functions correctly. No problems.
  • If I open and use a macro from a file that was developed/used in Office 2010 previously, I receive a "File Not Found: VBA6.dll" error message.
  • Once I start receiving the message, I receive it on all VBA macro's; even the new ones that (not more than 30 seconds) previously worked fine.
  • If I then re-create a new Excel file and new VBA Project, that individual piece of new code works fine. No problems - until I run code in one of the 'error files'. The fault then spreads into my new developments.

It's as if Excel is getting its references confused but every time I check them (on good or bad files) they are always exactly the same.

Note:

  • None of my references are missing.
  • I don't have VBA6.dll on my system; I have VBA7 and the 'Visual Basic for Application' reference refers too 'C:\Windows\SysWOW64\msvbvm60.dll'
  • There are two other 'Visual basic for Application' references on the list but it wont let me change them
  • It works on new files without VBA6.dll so I assume it isn't required?
  • I have checked for and installed all the latest Windows updates.

What should I do to troubleshoot this problem?

  • If you think I need VBA6.dll, is that because the referenced libraries use it?
  • If so then why are they not using VBA7?
  • And why does it work correctly before opening an old VBA6 file? Does Excel suddenly decide all files must use VBA6 just because one file did previously?

Anything to cure me of my confusion is much appreciated,

Best regards

EDIT: I almost forgot to mention;

  • When I try to debug the error after receiving it, Excel crashes (every time).
  • I also sent a 'bad file' to a colleague who [with the same system configuration] hasn't yet received this problem - and they also received the error. Suggesting it is something wrong with the files?

EDIT 2:

The problem is not yet resolved. I hope the downvote will not hinder my chances of an answer.

  • I have also tried re-registering libraries but nothing has changed.
  • If I open a 'bad file' I can add new Macros and they work fine; but the second I run an existing Macro and receive the error, the new Macros do not work either.
like image 384
Robert Avatar asked Mar 18 '23 09:03

Robert


1 Answers

The error was caused during Office 2013 (64-bit) installation. The VBA7 DLL was not registered correctly so I had to open regedit and manually input the correct filepath in both

  • HKEY_CLASSES_ROOT\TypeLib{000204EF-0000-0000-C000-000000000046}\
    • 6.0\9\win32
    • 4.2\9\win32

Replacing the 'C:\Windows\SysWOW64\msvbvm60.dll' data value (mentioned in the question) for Visual Basic for Applications to the VBA7 DLL filepath. Which on my system is:

  • C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll

All files now work; I hope this solves the problem for anyone else in the future.

like image 165
Robert Avatar answered Mar 27 '23 16:03

Robert