以编程方式添加引用 [英] Add references programmatically

查看:27
本文介绍了以编程方式添加引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个无法在某些客户端上运行的访问应用程序,主要是因为引用已损坏.例如,当您使用 access runtime 2007 启动 access 应用程序但安装了 2003 或 2000 版本的 office 时,就会发生这种情况.左/右/修剪等功能就停止工作了.

we have an Access-Application which does not work on some clients, mainly because references are broken. That happens for example when you start the access application with access runtime 2007 but have office in version 2003 or 2000 installed. Functions like Left/Right/Trim etc. just stop working then.

我认为解决此问题的唯一方法是以编程方式检查安装了哪个 Office 版本并以编程方式添加引用,因为在这些异构环境中,我们无法控制用户已安装的内容.具体来说,我需要引用 Excel 和 Word 的 Microsoft Office 对象库.

I think the only way to fix this problem is to programmtically check which office version is installed and add the references programmatically as in these heterogenous environments we cannot control what the user has installed. Specifically I need to reference the Microsoft Office Object libraries for Excel and Word.

但我既没有所有 office 版本的 guid,也不知道如何自动检查它们.

But I neither have the guids of all office versions nor have a clue how to check them automatically.

推荐答案

如果您提供 MDE/ACCDE,您将无法更新您的参考资料.

If you ship an MDE/ACCDE you can't update your references.

但是哪些具体的参考资料给您带来了问题?您可能正在引用 Word、Excel 或 Outlook.如果是这样,请使用后期绑定,因此您的解决方案与客户端系统上安装的版本无关.

But what specific references are causing you your problems? Chances are you are referencing Word, Excel or Outlook. If so use late binding so your solution doesn't matter what version is installed on the client system.

后期绑定意味着您可以安全地删除引用,并且只有在应用执行相关代码行时才会出现错误.而不是在启动应用程序时出错并且根本不允许用户进入应用程序.或者在击中中、左或修剪函数调用时.

Late binding means you can safely remove the reference and only have an error when the app executes lines of code in question. Rather than erroring out while starting up the app and not allowing the users in the app at all. Or when hitting a mid, left or trim function call.

当您不知道外部应用程序的哪个版本将驻留在目标系统上时,这也非常有用.或者,如果您的组织正在从一个版本迁移到另一个版本.

This also is very useful when you don't know what version of the external application will reside on the target system. Or if your organization is in the middle of moving from one version to another.

有关更多信息,包括附加文本和一些详细链接,请参阅Microsoft Access 中的后期绑定"页面.

For more information including additional text and some detailed links see the "Late Binding in Microsoft Access" page.

这篇关于以编程方式添加引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆