How can I make my C# MS Excel 2007 add-in compatible with Excel 2000-2003, using VSTO ?

Hi,

I've created an add-in for Microsoft Excel 2007 with Visual Studio 2005 and VSTO, and I'd like to make it compatible with older versions of MS Office (2000-2003).

It would not be a major problem if I could build 2 different add-ins dedicated to both versions of Office, but I only have MS Office 2007 installed on my computer, so I can't add the references to Office 2000-2003 in my project.

Would you have any ideas to solve this problem?

Thanks,
Julien
LVL 2
JulienVanAsked:
Who is Participating?
 
Daniel JungesCommented:
The best solution to make compatible with all MSOffice versions is by building only one package that reference MSoffice 2000, so its work fine for all msoffice versions. If you dont can reference it then you you have consider some items:
- all arrays you have to access with, ex:
      ActiveDocument.Tables.Item(tableNr);   instead    ActiveDocument.Tables[tableNr];
- for all eventhandler you have to use ApplicationEvents2_... enventhandlers, ex:
      myApp.DocumentBeforeClose += new WORD.ApplicationEvents2_DocumentBeforeCloseEventHandler( WordApp_DocumentBeforeClose );


but im not sure if that works when builded by reference of msoffice 2007.

i sugest build an minimal application and try to run it on an PC using other versions of msoffice

regards
junges
0
 
JulienVanAuthor Commented:
Hi junges,

Thanks for your comment, the problem is that I don't know how to build a package that references MSOffice 2000 since I've only Office 2007 installed on my computer.

Julien
0
Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

 
Daniel JungesCommented:
come month ago i have buided a separated packege foreach mso version, with a lot of ifdefs in my source. the bigest diffference are the follow:

- all arrays you have to access with, ex:   ActiveDocument.Tables.Item(tableNr)

- for all eventhandler you have to use ApplicationEvents2_... enventhandlers, ex:
      myApp.DocumentBeforeClose += new WORD.ApplicationEvents2_DocumentBeforeCloseEventHandler( WordApp_DocumentBeforeClose );

if you are accessing arrays or using eventhandler then use the sample above that works for mso 2000.
0
 
JulienVanAuthor Commented:
Thank you for the information junges.
As I don't have Office 2000-2003 installed on my computer, would you know if there is a way to create references for it and build the package anyway?
0
 
JulienVanAuthor Commented:
Thank you, it's exactly what I need, you're a real expert!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.