2007 和 2003 之间的 Microsoft 对象库兼容性
我在 Excel 2007 中有一个与 Microsoft Word 交互的宏。我应用 Microsoft Word 12.0 对象库来访问必要的命令。但是,当 Office 2003 用户尝试使用该宏时,他会收到错误消息。这是因为 Office 2003 使用 Microsoft Word 11.0 对象库。 12.0 库被视为丢失。
如果我使用 11.0 对象库保存 2003 年的文档,则一切正常。 2003 和 2007 用户都可以使用该宏。但2007年似乎自动将11.0对象库更新到12.0。因此,如果用户在 2007 年保存文档并尝试将其传回 2003 年的用户,该功能将再次中断。
有没有办法让VBA在使用2003时引用11.0?
I have a macro in Excel 2007 that interacts with Microsoft Word. I apply the Microsoft Word 12.0 Object Library in order to access the necessary commands. However, when an Office 2003 user tries to use the macro, he gets an error. This is because Office 2003 uses the Microsoft Word 11.0 Object Library. The 12.0 library is seen as missing.
If I save the document in 2003 with the 11.0 Object library, everything works fine. Both 2003 and 2007 users are able to use the macro. But 2007 seems to automatically update the 11.0 object library to 12.0. Thus if a user saves the document in 2007 and tries to pass it back to a 2003 user, the functionality will break once again.
Is there a way to tell VBA to reference 11.0 when using 2003?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用后期绑定。删除对 Word 库的引用并使用:
您需要将所有内置 Word 常量更改为值。您可以在删除库引用之前找到这些值,方法是
在立即窗口中键入,或者使用对象浏览器。
You can use late binding. Remove the reference to the Word library and use:
You will need to change all built-in Word constants to values. You can find the values before you remove the library reference by typing say,
Into the immediate window, or by using the Object Browser.