Hi
Is there a way, in VB.Net, to write a windows based program that will use
more than one version of Office (Excel)?
Example: if office 2000 then else if office 2003 then.
Is this possible? Examples?
Thanks 11 2714
Hi
BrianDH wrote: Hi Is there a way, in VB.Net, to write a windows based program that will use more than one version of Office (Excel)?
Example: if office 2000 then else if office 2003 then.
Is this possible? Examples?
Late-Binding is your friend
Dim xlAppl As Object = CreateObject("Excel.Application")
Frank
Use the registry to check the version....
Pseudo code untested.
Public Function getInstance1() As Excel.ApplicationClass
Dim regVersion As RegistryKey
Dim keyValue As String
Dim versionnumber As Integer = 9
Do
keyValue = "Software\\Microsoft\\Office\\" & versionnumber &
".0\\Excel"
regVersion = Registry.LocalMachine.OpenSubKey(keyValue,
False)
If regVersion Is Nothing Then
'Do this and exit
End If
If versionnumber = 10 Then
'Do this
End If
Exit Do
Loop
End Function
"BrianDH" <Br*****@discussions.microsoft.com> wrote in message
news:95**********************************@microsof t.com: Hi Is there a way, in VB.Net, to write a windows based program that will use
more than one version of Office (Excel)?
Example: if office 2000 then else if office 2003 then.
Is this possible? Examples?
Thanks
thanks will give it a try!
"Frank Liebelt" wrote: Hi
BrianDH wrote: Hi Is there a way, in VB.Net, to write a windows based program that will use more than one version of Office (Excel)?
Example: if office 2000 then else if office 2003 then.
Is this possible? Examples?
Late-Binding is your friend Dim xlAppl As Object = CreateObject("Excel.Application")
Frank
Thanks will give it a try!
"scorpion53061" wrote: Use the registry to check the version....
Pseudo code untested.
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel" regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False) If regVersion Is Nothing Then 'Do this and exit End If If versionnumber = 10 Then
'Do this
End If
Exit Do Loop End Function
"BrianDH" <Br*****@discussions.microsoft.com> wrote in message news:95**********************************@microsof t.com: Hi Is there a way, in VB.Net, to write a windows based program that will use
more than one version of Office (Excel)?
Example: if office 2000 then else if office 2003 then.
Is this possible? Examples?
Thanks
Kelly,
"scorpion53061" <ad***@nospamherekjmsolutions.com> schrieb: Use the registry to check the version....
Pseudo code untested.
:-)
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel"
The "\\" should be "\" :-).
--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Hi Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel" regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False) If regVersion Is Nothing Then 'Do this and exit End If If versionnumber = 10 Then
'Do this
End If
Exit Do Loop End Function
With this code you could read the excel version but it doesn't make the
application able to work with different excel versions.
Example:
I have Excel 2003, the application has a reference to the Excel(11) COM
Object.
The user has Excel 2000 (10). The only i can do is inform the user that
his Excel version won't work with this application.
But with Late-Binding the application works with Excel 97, 2000, XP,
2003 without any reference.
Late-Binding makes a application independent from any version.
Frank
On Thu, 28 Oct 2004 10:55:01 -0700, "BrianDH" <Br*****@discussions.microsoft.com> wrote:
¤ Hi
¤ Is there a way, in VB.Net, to write a windows based program that will use
¤ more than one version of Office (Excel)?
¤
¤ Example: if office 2000 then else if office 2003 then.
¤
¤ Is this possible? Examples?
See the following:
INFO: Writing Automation Clients for Multiple Office Versions http://support.microsoft.com/default...b;en-us;244167
Paul ~~~ pc******@ameritech.net
Microsoft MVP (Visual Basic)
Herfried,
Yeah you got me.......
:)
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eQ**************@TK2MSFTNGP12.phx.gbl: Kelly,
"scorpion53061" <ad***@nospamherekjmsolutions.com> schrieb: Use the registry to check the version....
Pseudo code untested.
:-)
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber &
".0\\Excel"
The "\\" should be "\" :-).
Frank,
The idea is to take the version number garnered, then if code your app
around the idea if they have 10 and you know your code needs to adapt to
that version so all versions are available. This is the method one could
use to find the office version on the end users machine and try to
accommodate all versions in your code.
As a general rule, the office versions are backward compatible. What
works for office 2000 will work for office 2003.
Unfortunately this general rule gets broken on occasion which makes it
necessary for you to have case statements saying what to do for a
particular version of office. Even using late binding is no guarantee in
all cases you are going to be safe in all office versions for a
particular event.
"Frank Liebelt" <li*********@arcor.de> wrote in message
news:41***********************@newsread4.arcor-online.net: Hi
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel" regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False) If regVersion Is Nothing Then 'Do this and exit End If If versionnumber = 10 Then
'Do this
End If
Exit Do Loop End Function
With this code you could read the excel version but it doesn't make the application able to work with different excel versions. Example: I have Excel 2003, the application has a reference to the Excel(11) COM Object. The user has Excel 2000 (10). The only i can do is inform the user that his Excel version won't work with this application. But with Late-Binding the application works with Excel 97, 2000, XP, 2003 without any reference.
Late-Binding makes a application independent from any version.
Frank
Frank,
Can you open a xml document in Excel 97 using late binding?
"Frank Liebelt" <li*********@arcor.de> wrote in message
news:41***********************@newsread4.arcor-online.net: Hi
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel" regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False) If regVersion Is Nothing Then 'Do this and exit End If If versionnumber = 10 Then
'Do this
End If
Exit Do Loop End Function
With this code you could read the excel version but it doesn't make the application able to work with different excel versions. Example: I have Excel 2003, the application has a reference to the Excel(11) COM Object. The user has Excel 2000 (10). The only i can do is inform the user that his Excel version won't work with this application. But with Late-Binding the application works with Excel 97, 2000, XP, 2003 without any reference.
Late-Binding makes a application independent from any version.
Frank
Hello Guys:
Does anyone know How to create an Excel event handler while using late
binding?
I had to use late binding because my application must run across multiple
MS-Office versions, but I need to catch WorkbookBeforeClose Event of the
application object.
I tried both: delegates and WithEvents keyword like I found in Microsoft
documents, but it doesn't work because those methods use early binding. http://support.microsoft.com/default...b;en-us;249843 http://support.microsoft.com/default...b;en-us;247579 http://support.microsoft.com/default...b;en-us;244167
Thanks
--
MFM
"Frank Liebelt" wrote: Hi
Public Function getInstance1() As Excel.ApplicationClass Dim regVersion As RegistryKey Dim keyValue As String Dim versionnumber As Integer = 9 Do keyValue = "Software\\Microsoft\\Office\\" & versionnumber & ".0\\Excel" regVersion = Registry.LocalMachine.OpenSubKey(keyValue, False) If regVersion Is Nothing Then 'Do this and exit End If If versionnumber = 10 Then
'Do this
End If
Exit Do Loop End Function
With this code you could read the excel version but it doesn't make the application able to work with different excel versions. Example: I have Excel 2003, the application has a reference to the Excel(11) COM Object. The user has Excel 2000 (10). The only i can do is inform the user that his Excel version won't work with this application. But with Late-Binding the application works with Excel 97, 2000, XP, 2003 without any reference.
Late-Binding makes a application independent from any version.
Frank This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matt |
last post by:
I have an ASP page that calls ASP routines that I created that execute
a database query and return the results to a recordset. I then iterate
through the recordset and display the data in a table....
|
by: Matthew Wieder |
last post by:
I have the following requirements:
Build a stand-alone C# application that asks the user to click in a cell
in an Excel spreadsheet, and then displays the address of that cell in
the C#...
|
by: Mansi |
last post by:
I need to do some research on how to use excel automation from c#. Does
anyone know of any good books related to this subject?
Thanks.
Mansi
|
by: Jeti [work] |
last post by:
I have Office2003 installed, and trying to read excel file from C#. I made
ExcelWrapper class, and it worked fine until new version of offide came!
Now, when i'm trying to open workbook, i get an...
|
by: Maik |
last post by:
Hello,
I've developed an assembly, which opens an excel workbook and readout the
range names and -values. I'm working with Office XP on my computer. I want to
deploy this assembly on computers,...
|
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,...
|
by: Brian Conklin |
last post by:
Hello Eneryone,
I am having a problem. I have written a little app that will take a text
"pipe" delimited file and place all of the values in to an Excel
spreadsheet. It works great on any of my...
|
by: |
last post by:
I wrote a class in VB.NET to export the contents of a datagrid to Excel. It
works perfectly on my machine, but it fails on my customers' PCs that have
identical versions of Win XP (SP1) and Excel...
|
by: Alain \Mbuna\ |
last post by:
Hi everybody.
In my program I have some data that is calculated after some input from the
user. I have written some code that opens an Excel workbook, with 5
worksheets and the calculated data...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
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...
| |