Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

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

Posted on 2009-02-23
6
Medium Priority
?
913 Views
Last Modified: 2013-11-10
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
0
Comment
Question by:JulienVan
  • 3
  • 3
6 Comments
 
LVL 14

Assisted Solution

by:Daniel Junges
Daniel Junges earned 2000 total points
ID: 23720059
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
 
LVL 2

Author Comment

by:JulienVan
ID: 23720240
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
 
LVL 14

Assisted Solution

by:Daniel Junges
Daniel Junges earned 2000 total points
ID: 23720590
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
LVL 2

Author Comment

by:JulienVan
ID: 23753653
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
 
LVL 14

Accepted Solution

by:
Daniel Junges earned 2000 total points
ID: 23754462
0
 
LVL 2

Author Closing Comment

by:JulienVan
ID: 31552060
Thank you, it's exactly what I need, you're a real expert!
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How to get Spreadsheet Compare 2016 working with the 64 bit version of Office 2016
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.

581 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question