以编程方式添加参考 [英] Add references programmatically

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

问题描述

我们有一个Access-Application,它在某些客户端上不起作用,主要是因为引用已损坏.例如,当您使用Access Runtime 2007启动Access应用程序但安装了2003或2000版本的Office时,就会发生这种情况.这样,诸如Left/Right/Trim等功能便会停止工作.

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版本的指南,也没有如何自动检查它们的线索.

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天全站免登陆