vba 加载 DLL 错误,丢失:Microsoft Word 16.0 对象库

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/45276302/
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 12:57:38  来源:igfitidea点击:

Loading DLL Error, MISSING: Microsoft Word 16.0 Object Library

excelexcel-vbavba

提问by adam

So I had this macro file that worked fine until this afternoon after another colleague of mine ran the macro.

所以直到今天下午我的另一个同事运行了这个宏之后,我的这个宏文件才能正常工作。

when i opened it, it kept showing Loading DLL Error

当我打开它时,它一直显示加载 DLL 错误

enter image description here

在此处输入图片说明

I went into the object library, to find this:

我进入了对象库,找到了这个:

enter image description here

在此处输入图片说明

Not exactly familiar with object library references here but are there any quick fixes to this?

对这里的对象库引用不是很熟悉,但是有什么快速解决方法吗?

I've tried unchecking the missing MS 16 word object but it just resets itself right after i click "OK"

我已经尝试取消选中丢失的 MS 16 字对象,但它只是在我单击“确定”后立即自行重置

回答by Sam

You have a reference to Word 2016, but is it installed at your colleague's computer? The quick workaround is to find a reference with a similar name further down the list. Microsoft Word 15 Object Library or similar will most likely do. If there's nothing like it, it is time to re-install Office Changing the reference is a bit cumbersome though, as it'll stop working at yours. Then you must replace all your declarations of Word objects in your code with CreateObject(...)

您有 Word 2016 的参考,但它是否安装在您同事的计算机上?快速解决方法是在列表下方查找具有相似名称的参考。Microsoft Word 15 Object Library 或类似的很可能会这样做。如果没有类似的东西,是时候重新安装 Office 更改参考有点麻烦,因为它会停止在您的工作中工作。然后,您必须用 CreateObject(...) 替换代码中所有 Word 对象的声明

回答by Steen BN CPH-DK

When using same workbook from different Excel versions and with VBA reference to the Word application - you will get this error. Use late binding (CreateObject..) and no reference!

当使用来自不同 Excel 版本的相同工作簿以及对 Word 应用程序的 VBA 引用时 - 您将收到此错误。使用后期绑定(CreateObject..)并且没有引用!