Nigel Stratton

I want to develop a routine in c# 2.0 to make some simple modifications to an existing Excel document. The target machines may have either Excel 2003 or 2007.


I have 2007 on my machine but could add 2003 if necessary.


What do I load in to VS2005 to develop such an application


Thanks,
Nigel Stratton



Re: Visual Studio Tools for Office Target either Excel 2003 or 2007

Cindy Meister

Hi Nigel

Please note that pure Interop questions are technically off-topic in this forum. The forum is dedicated to the VSTO technology, an add-on for Visual Studio that lets you do certain things. But these things are always version-specific... You'll find a list of resources in the Please Read First message at the top of this forum for pure interop questions.

General rule of thumb: develop against the oldest version and the oldest set of PIAs. Note that you should NOT install multiple versions of Office in-parallel on your development machine. Use virtual machines for each software combination you develop for. MSFT best-policy programming practice for .NET is to create a separate app for each software version, so what you contemplate is... frowned on by "the powers that be".

Depending on what you want to do you may need to use late-binding (PInvoke) in order to support both versions. C# and the VB-world don't see eye-to-eye on certain things, including the concept of optional parameters. The Office dev teams think nothing of adding a parameter or two in subsequent application versions to support new functionality. But you C# app will break (COM error) if the method signatures in the PIAs don't match those used in your code.

This topic has been discussed, off-and-on, in the office.developer set of newsgroups.






Re: Visual Studio Tools for Office Target either Excel 2003 or 2007

Ji Zhou ¨C MSFT

Hi Nigel,

Andrew Whitechapel's blog will tell you why VSTO does not support building one add-in for multiple version of Office.

Look at this link: http://blogs.msdn.com/andreww/archive/2007/06/15/can-you-build-one-add-in-for-multiple-versions-of-office.aspx

Wish this helps! :-)

Thanks

Ji