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). My new computer has Win开发者_如何转开发dows 7 and Office 2010 installed, and the references don't work anymore (there's only Office 14 Object Library available).
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)? I've tried to install the "Redistributable Primary Interop Assemblies" for Office 2003, but couldn't do it without installed 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
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.
I doubt kor_ is still having this issue, but I had a hard time finding help on this one.
I was having a similar issue and found NetOffice after much searching. It's a wrapper for the COM object so that you can get late-binding compatibility without having to change your code.
I believe the PIAs still need to be installed by the user along with office.
http://netoffice.codeplex.com/
With late binding you can remove any reference to Office Interop dll's. 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)
精彩评论