473,396 Members | 1,866 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Version Proofing Excel COM/.NET Wrapper

Not sure the best group to post to, so sorry for the cross post :(.

There are several posts out there of how to automate excel from .net, i.e in
the sample below, they are using Excel 9.0... However, on my machine, I have
12.0... no big deal.. I see both in the post below, and on my machine, there
is also a 'Microsoft Excel 5.0 Type Library'. Is it best to use this
reference to be able to target an arbitrary version? I'd assume that there
are obvious limitations in using an older version, but I'd assume that the
basics of reading/writing cells, navigating, creating a sheet, etc, would be
supported?

Is my thinking correct, or is there another 'best practice' to version proof
a utility that will be shared with others that may/may not have the same
version I have?

http://www.c-sharpcorner.com/UploadF...iewin.NET.aspx

"The first step is to create a reference in your project to Excel 9.0
Objects Library. This is done by right mouse clicking on the References
folder in the Solution Explorer and choosing Add Reference. This brings up
the Tab Dialog below. Choose the COM Tab and pick Microsoft Excel 9.0
Objects Library."
Jan 4 '08 #1
2 1725

Note: I have not come across such a scenario.

However IMO, using latest COM library for Excel 12.0 might save the file
as xlsx or according to new format. Older ones such as 5.0 might create
xls file or old format.

As long as basics are concerned for reading to file/writing to file - it
should work as expected. Higher versions might take care of lower
version files (for backward compatibility)

So, if all users do not have excel 12.0, I would suggest using VB6 way
of instantiating excel (e.g. CreateObject("Excel.Application"). This
used to invoke appropriate Excel automation instance irrespective of
which ver. of Excel is installed. This method is a late-bound approach
so, it might not have IDE support & method calls might be little slow.

MSDN might have a better solution or VBA/VSTO MVPs can suggest better
ways & also correct me, if I am wrong in my understanding.
news.microsoft.com wrote:
Not sure the best group to post to, so sorry for the cross post :(.

There are several posts out there of how to automate excel from .net, i.e in
the sample below, they are using Excel 9.0... However, on my machine, I have
12.0... no big deal.. I see both in the post below, and on my machine, there
is also a 'Microsoft Excel 5.0 Type Library'. Is it best to use this
reference to be able to target an arbitrary version? I'd assume that there
are obvious limitations in using an older version, but I'd assume that the
basics of reading/writing cells, navigating, creating a sheet, etc, would be
supported?

Is my thinking correct, or is there another 'best practice' to version proof
a utility that will be shared with others that may/may not have the same
version I have?

http://www.c-sharpcorner.com/UploadF...iewin.NET.aspx

"The first step is to create a reference in your project to Excel 9.0
Objects Library. This is done by right mouse clicking on the References
folder in the Solution Explorer and choosing Add Reference. This brings up
the Tab Dialog below. Choose the COM Tab and pick Microsoft Excel 9.0
Objects Library."

Jan 4 '08 #2
I think this approach is acceptable. Personally, I prefer targetting a
specific version of Excel and 'certifying' my application to run against that
version. It's much simpler for trouble-shooting and all those other version
compatibility issues that drive developers wild. However, this is strictly
according to taste and is certainly not the only way to do it.

"Kalpesh" wrote:
>
Note: I have not come across such a scenario.

However IMO, using latest COM library for Excel 12.0 might save the file
as xlsx or according to new format. Older ones such as 5.0 might create
xls file or old format.

As long as basics are concerned for reading to file/writing to file - it
should work as expected. Higher versions might take care of lower
version files (for backward compatibility)

So, if all users do not have excel 12.0, I would suggest using VB6 way
of instantiating excel (e.g. CreateObject("Excel.Application"). This
used to invoke appropriate Excel automation instance irrespective of
which ver. of Excel is installed. This method is a late-bound approach
so, it might not have IDE support & method calls might be little slow.

MSDN might have a better solution or VBA/VSTO MVPs can suggest better
ways & also correct me, if I am wrong in my understanding.
news.microsoft.com wrote:
Not sure the best group to post to, so sorry for the cross post :(.

There are several posts out there of how to automate excel from .net, i.e in
the sample below, they are using Excel 9.0... However, on my machine, I have
12.0... no big deal.. I see both in the post below, and on my machine, there
is also a 'Microsoft Excel 5.0 Type Library'. Is it best to use this
reference to be able to target an arbitrary version? I'd assume that there
are obvious limitations in using an older version, but I'd assume that the
basics of reading/writing cells, navigating, creating a sheet, etc, would be
supported?

Is my thinking correct, or is there another 'best practice' to version proof
a utility that will be shared with others that may/may not have the same
version I have?

http://www.c-sharpcorner.com/UploadF...iewin.NET.aspx

"The first step is to create a reference in your project to Excel 9.0
Objects Library. This is done by right mouse clicking on the References
folder in the Solution Explorer and choosing Add Reference. This brings up
the Tab Dialog below. Choose the COM Tab and pick Microsoft Excel 9.0
Objects Library."
Jan 4 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jen | last post by:
Trying to take one table in access and split it into multiple excel files(using an excel template); and then email based on email addresses in Table2; Of course, I would like to do all of this...
2
by: lasmit42 | last post by:
Guys I am writing a program which reads the first cell of many Excel spreadsheets and then takes some actions. The problem that I am experiencing is that each Excel instance I create persists...
3
by: Boris Condarco | last post by:
Hi gurus, I'm using excel 2000 to show data that comes from datagrid. The problem is that for any reason the asp.net application maintains the excel open, even though, i do close it. Besides,...
6
by: Brent | last post by:
Having used every combonation of excel 9/10/11 and office 10/11 possible as references i still can not create an excel object! Any ideas? Just using this simple bit below i get "Excel.appication...
7
by: Alan Roberts | last post by:
Can someone please explain the following for me... I am trying to link to a .NET DLL from Excel. Excel needs to pass a reference to itself to the DLL and then the DLL needs to perform some work...
8
by: matt | last post by:
hello, can anyone speak to some of the common or preferred methods for building Excel .XLS files, programmatically thru the .NET framework? i have an intranet app that needs to generate &...
4
by: The Night Blogger | last post by:
Is there a way to push data to Microsoft Excel & Word from a Python Application Is this a cross platform feature ? I'll need to push data on MS Windows & Mac OS X ....
10
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine...
4
by: Steve Alpert | last post by:
With JScript in html, the object codebase can be given a version number which will do a pull from the server if the user has an earlier version. Is there a comparable setup inside an interop...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.