Program that works in all version of excel

0 votes
A Windows Form application I recently created has a number of datagrids. The data must be exported into Excel for my client. They use various Excel versions, including 2003, 2007, 2010, and 2013, whereas I use Office 2013. I utilized references from Excel 2013

(Object Library for Excel 15.0 from Microsoft)

In my course. My client recently complained that the export option was broken. My research indicates that my application appears to function properly for users of Office 2013 but not for users of earlier Office versions.

What can I do to ensure that my application runs properly in earlier Excel versions?
Sep 23, 2022 in Others by Kithuzzz
• 38,010 points
311 views

1 answer to this question.

0 votes

Knowing that all of your users will have Excel allows you to remove the DLL references from your project and convert your Excel references to "Objects" rather than hardcoded Excel objects. As long as you don't use a NEW function that isn't available in the earlier versions, this will work with all versions of Office.

For example, instead of this:

Dim _xlApp As Excel.Application
Dim _xlBook As Excel.Workbook

Try this:

Dim _xlApp As Object 'Excel.Application
Dim _xlBook As Object 'Excel.Workbook

Everything works the same (except no intellisence) except for instantiation of the excel application:

_xlApp = CreateObject("Excel.Application") 'New Excel.Application

I have done it this way for 15 years without ever changing my code based on different versions.

answered Sep 24, 2022 by narikkadan
• 63,420 points

Related Questions In Others

0 votes
1 answer

Change date format of cell in excel from dd.mm.yyyy to yyy/mm/dd ( excel version 2013 )

Hello :)   Excel’s Format Cells function can quickly ...READ MORE

answered Feb 9, 2022 in Others by gaurav
• 23,260 points
1,311 views
0 votes
1 answer
0 votes
1 answer

How to look in all folders in directory to change file extensions of excel file?

Loop Through All Subfolders Using VBA Dim strCurrentFileExt ...READ MORE

answered Nov 24, 2022 in Others by narikkadan
• 63,420 points
349 views
0 votes
1 answer

How to divide data in excel into 4 columns whose sum is almost equal to 1/4 of the sum of all values/

5049 is the sum of all numbers, ...READ MORE

answered Feb 7, 2023 in Others by narikkadan
• 63,420 points
415 views
0 votes
1 answer

How to add Header and Footer in excel with vb.net?

This code will work: Imports Microsoft.Office.Interop Private Sub Button1_Click(sender ...READ MORE

answered Dec 10, 2022 in Others by narikkadan
• 63,420 points
504 views
0 votes
1 answer

How to remove borders from cells in a range in Excel using VB.net?

range.Borders(Excel.XlBordersIndex.xlEdgeLeft).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeRight).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeTop).LineStyle = Excel.XlLineStyle.xlLineStyleNone range.Borders(Excel.XlBordersIndex.xlEdgeBottom).LineStyle ...READ MORE

answered Jan 5, 2023 in Others by narikkadan
• 63,420 points
1,109 views
0 votes
1 answer

Releasing COM-Object not necessary?

This place has infamously poor Office COM ...READ MORE

answered Feb 24, 2023 in Others by narikkadan
• 63,420 points
438 views
0 votes
1 answer

Display random images from USB on Raspberry Pi

Hey, it's a cool idea! And, since ...READ MORE

answered Nov 28, 2018 in IoT (Internet of Things) by nirvana
• 3,130 points
1,003 views
0 votes
1 answer

How to get sum of all matches of HLOOKUP in Excel?

Consider: =SUMPRODUCT((A1:E1="apple")*(A2:E2)) To include more ...READ MORE

answered Oct 16, 2022 in Others by narikkadan
• 63,420 points
2,085 views
0 votes
1 answer

Excel - Make a graph that shows number of occurrences of each value in a column

There is probably a better way to ...READ MORE

answered Oct 21, 2022 in Others by narikkadan
• 63,420 points
7,790 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP