vba “找不到文件:VBA6.dll”错误 - 奇怪的行为

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/27859839/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-12 05:45:59  来源:igfitidea点击:

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

excelvbaexcel-vbadll

提问by Robert

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.

我正在使用 Office 2013(64 位)运行 Windows 8。我正在尝试在 Excel 中继续开发从 Office 2010(32 位)开始的 VBA。我知道必要的 64 位更改,但是我收到了令人困惑的配置错误。

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.
  • 如果我创建一个新的 Excel 文件和 VBA 项目;我所有的 VBA 代码都能正常运行。没问题。
  • 如果我打开并使用之前在 Office 2010 中开发/使用的文件中的宏,我会收到“找不到文件:VBA6.dll”错误消息。
  • 一旦我开始接收消息,我就会在所有 VBA 宏上收到它;即使是以前运行良好的新的(不超过 30 秒)。
  • 如果我然后重新创建一个新的 Excel 文件和新的 VBA 项目,那段新代码就可以正常工作。没问题 - 直到我在“错误文件”之一中运行代码。错误然后蔓延到我的新发展。

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.

就好像 Excel 将其引用混淆了,但每次我检查它们时(无论是好文件还是坏文件),它们总是完全相同。

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.
  • 我的所有参考资料都没有丢失。
  • 我的系统上没有 VBA6.dll;我有 VBA7 并且“Visual Basic for Application”参考也引用了“C:\Windows\SysWOW64\msvbvm60.dll”
  • 列表中还有另外两个“Visual basic for Application”参考,但它不会让我更改它们
  • 它适用于没有 VBA6.dll 的新文件,所以我认为它不是必需的?
  • 我已经检查并安装了所有最新的 Windows 更新。

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?
  • 如果您认为我需要 VBA6.dll,是不是因为引用的库使用了它?
  • 如果是这样,那么他们为什么不使用 VBA7?
  • 为什么在打开旧的 VBA6 文件之前它可以正常工作?Excel 是否突然决定所有文件都必须使用 VBA6 仅仅因为以前有一个文件?

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?
  • 当我在收到错误后尝试对其进行调试时,Excel 崩溃(每次)。
  • 我还向 [具有相同系统配置] 尚未收到此问题的同事发送了一个“错误文件” - 他们也收到了错误。暗示文件有问题?

EDIT 2:

编辑2:

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

问题还没有解决。我希望downvote不会妨碍我回答的机会。

  • 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.
  • 我也试过重新注册图书馆,但没有任何改变。
  • 如果我打开一个“坏文件”,我可以添加新的宏并且它们工作正常;但是当我运行现有的宏并收到错误时,新的宏也不起作用。

回答by Robert

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

该错误是在 Office 2013(64 位)安装期间引起的。VBA7 DLL 未正确注册,因此我必须打开 regedit 并在两者中手动输入正确的文件路径

  • HKEY_CLASSES_ROOT\TypeLib{000204EF-0000-0000-C000-000000000046}\
    • 6.0\9\win32
    • 4.2\9\win32
  • 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:

将 Visual Basic for Applications 的“C:\Windows\SysWOW64\msvbvm60.dll”数据值(在问题中提到)替换为 VBA7 DLL 文件路径。在我的系统上是:

  • C:\Program Files\Common Files\Microsoft Shared\VBA\VBA7.1\VBE7.dll
  • 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.

所有文件现在都可以工作;我希望这可以解决未来其他人的问题。