VS 2005 against Office XP PIA on system with Office 2003/2007? - ms-office

On my development system, I am running Office 2007, and previously had Office 2003 installed, and thus have the Microsoft Office 11.0 and 12.0 Object Models available. Our production environment is in the process of being upgraded to Office 2007, but it hasn't happened yet - still running Office XP in production, and I need to be able to debug an (inherited) VB.Net (VS 2005) app that uses Office Interop against Office XP (10.0) (Excel).
Can I simply download, install, and reference the Office XP PIA's (http://www.microsoft.com/downloads/details.aspx?familyid=C41BD61E-3060-4F71-A6B4-01FEBA508E52) in order to compile an run the app? A previous build has been tested against Office 2007 and it seemed to work with the "old" interop/PIAs.
I have the "old" Interop.Excel, etc., the only reference that is giving me a problem is the Microsoft Office 10.0 Object Model (which says Microsoft Office 12.0 Object Model but has an Exclamation mark in my IDE).
I also found http://www.codeproject.com/KB/office/Compile2003VstoVista2007.aspx (for Office 2003 on a system with 2007) which suggests installing the older version of Office and then massaging the project files in a text editor. While I don't mind using a text editor on the project files, I'd prefer not to install Office XP unless I have to (I have access to it if I do). And I'd prefer to be able to load the project as is (with the "old" reference).

Related

visual studio 2008 - add excel 2010 workbook

I have Visual Studio 2008, and will need to an Excel Workbook Project. The options for Excel 2007 and 2003 Workbook are there. But everytime I chose any of those it prompts me with an error saying "A compatible version of Microsoft Office is not installed on this computer. ...". So I checked my office version and sure enough it wasn't 2007 nor 2003, but 2010.
But I don't see any options Excel 2010 Workbook on my Visual Studio, already tried toggling the frameworks .NET 3.5/3.0/2.5 and it's none. I'm thinking maybe it is on .NET 4.0 so I tried downloading the 4.0 installer on microsoft site, but after the installation, there's still no .NET 4.0 in my VS2008, let alone Excel 2010 Workbook.
Any advice will be appreciated. Thanks!
I've done a lot of work in Excel from VB.net and never found a need for the Excel Workbook Project. You can do what you need to do by adding a reference to Excel and programming against it.
Check out: Automating Excel

How to user Microsoft Interop for Excel 2003 and 2010

Currently, I use the library for Excel 2010 but I need to install both 2003 and 2010 on my machine. How can I call Excel 2003 or 2010 in my code.
Edit: Maybe I didn't ask clearly. I want to use both applications in one project. So I want this to use Excel 2003 in some cases and in other 2010.
Excel.Application xlApp = new Excel.Application();
You can tell by the version number of the Interop library you use. 2003 is 12, 2010 is 15 (they skipped version 13) so after installing Office 2003 you can use the .Net tab in the Add References dialog box in Visual Studio to add the libraries for 12, test your code and then remove these and add the libraries for 15 and test your code again. The name of the library for 2003 is Microsoft Excel 12.0 Object Library, the name for 2010 is Microsoft Excel 15.0 Object Library.

COM Add-in for Excel installer problem

I have developed an Excel Add-in in Visual Studio 2008 for MS Office 2007. My client now wants this Add-in to work on office 2010 also. So, I used Visual Studio 2010 to achieve this requirement. Visual Studio 2010 automatically converted Visual Studio 2008 code to Visual Studio 2010. But the framework 3.5 remained same for this converted project, so I cannot compile this converted code in .Net framework 4.0 (It gives error). Hence, I left the code as is in the 3.5 framework and I created installer for office 2010 in visual studio 2010 & installed. Installation was successful but Add-in was unable to load because load behavior always gets changed from 3 to 2(error: a runtime error occurred while loading of COM-Add-in). So after searching on web I added an entry in the registry through the installer. It is working fine on office 2010, but it is not working on office 2007. I have to keep two different codebases & two different installers for office 2007 & office 2010 although code is exactly the same. I want single code base & single installer for my Excel Add-in that should work on office 2007 as well as office 2010. Can anyone help me in this? I would be really grateful if anyone could give me a solution at the earliest.

Does Visual Studio Tools for Office require Office to be installed?

Does Visual Studio Tools for Office require Office to be installed in order to work with excel files?
From the MSDN
The Microsoft Office primary interop assemblies must be installed into the global assembly cache (GAC) and registered before you can create or run a Visual Studio Tools for Office solution. You can then write managed code to interact with a Microsoft Office application's COM-based object model. For more information, see How to: Install Office Primary Interop Assemblies.
This second link states:
You can install the complete set of primary interop assemblies in the global assembly cache in two ways:
Perform a Complete installation of Microsoft Office.
Install them from the redistributable primary interop assemblies package.
This redistributable can be downloaded from here
The System Requirements say the following:
Version of Microsoft Office: Developing and running Office customizations built with VSTO 2005 or VSTO 2005 SE requires at least one of the following versions of Microsoft Office
Microsoft Office Professional Edition 2003
Microsoft Office Standard Edition 2003 (only application-level add-ins work with Standard Edition)
Microsoft Word 2003
Microsoft Excel 2003
Microsoft InfoPath 2003
Microsoft Outlook 2003
Microsoft Office Visio 2003
Microsoft Office PowerPoint 2003
2007 Microsoft Office system
Microsoft Office Word 2007
Microsoft Office Excel 2007
Microsoft Office Outlook 2007
Microsoft Office PowerPoint 2007
Microsoft Office Visio 2007
Microsoft Office InfoPath 2007

Office 2003 PIAs with Office 2007

Is it possible to target Outlook 2003 in a vb.net 2008 Windows application when working on a system that only has Office 2007 installed on it? I downloaded the 2003 PIAs, but they wont install without Office 2003 installed first. The point is, I don't want Office 2003 installed on my development machine.
Thanks
You can do it, but you have to browse to the PIAs directly when adding the reference.

Resources