简体   繁体   English

Office 2003互操作仅安装了Office 2010

[英]Office 2003 interop with only Office 2010 installed

We have an application (.NET 2.0) that uses Outlook 2003 features (Microsoft Office 11.0 Object Library). 我们有一个使用Outlook 2003功能(Microsoft Office 11.0对象库)的应用程序(.NET 2.0)。 My new computer has Windows 7 and Office 2010 installed, and the references don't work anymore (there's only Office 14 Object Library available). 我的新计算机安装了Windows 7和Office 2010,并且引用不再起作用(只有Office 14对象库可用)。

Is there any way to use Office 2003 dlls when Office 2010 is installed (I've heard that 2003 and 2010 cannot be installed on the same machine)? 安装Office 2010时是否有任何方法可以使用Office 2003 dll(我听说2003和2010不能安装在同一台机器上)? I've tried to install the "Redistributable Primary Interop Assemblies" for Office 2003, but couldn't do it without installed Office 2003. 我曾尝试为Office 2003安装“可再发行的主互操作程序集”,但如果没有安装Office 2003则无法执行此操作。

Rather that referencing a specific version of the libraries, use late binding. 而是引用特定版本的库,使用后期绑定。 That way you can develop against one version, but as long as you stick to using common functionality it'll work in other versions as well. 这样你就可以针对一个版本进行开发,但只要你坚持使用通用功能,它也可以在其他版本中使用。

This article explains the difference Binding for Office automation servers with Visual C# .NET 本文介绍了Office自动化服务器与Visual C#.NET的绑定差异

It can be easier to do the development using early binding so that you get Intellisense and then removing the references later on (which will take a little time. If it's worth itdepends a bit on your skill level with Office development. 使用早期绑定可以更容易地进行开发,这样您就可以获得智能感知,然后在以后删除引用(这需要一些时间。如果值得,那么在Office开发的技能水平上会有所下降。

I doubt kor_ is still having this issue, but I had a hard time finding help on this one. 我怀疑kor_仍然有这个问题,但我很难找到这个问题的帮助。

I was having a similar issue and found NetOffice after much searching. 我遇到了类似的问题,经过多次搜索后发现了NetOffice。 It's a wrapper for the COM object so that you can get late-binding compatibility without having to change your code. 它是COM对象的包装器,因此您可以获得后期绑定兼容性,而无需更改代码。

I believe the PIAs still need to be installed by the user along with office. 我相信PIA仍然需要由用户和办公室一起安装。

http://netoffice.codeplex.com/ http://netoffice.codeplex.com/

With late binding you can remove any reference to Office Interop dll's. 使用后期绑定,您可以删除对Office Interop dll的任何引用。 We have the same issue as you and this works: 我们和您有同样的问题,这有效:

Dim OutlApp As Object
Dim NewEmail As Object

OutlApp = CreateObject("Outlook.Application")
NewEmail = OutlApp.CreateItem(0) 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM