ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   COM interop XL2000 vs 2003 (https://www.excelbanter.com/excel-programming/366666-com-interop-xl2000-vs-2003-a.html)

Rick Humphrey

COM interop XL2000 vs 2003
 
Hi,

I am attempting to use VB.net to drive Excel 2000. So I add reference in my
project to MS XL Object Library 9.0... Everything is great, except here is
the issue....
The Box I'm developing on has Excel2000 & Excel2003 installed..... I want to
develop and deploy the project to the Excel2000 environment..... Is there an
easy way when I create the Excel.Application object to force it to open Excel
2000 and not Excel 2003?

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOpen.Click
Dim oXL As Excel.ApplicationClass
Dim oWkb As Excel.WorkbookClass
Dim oWkbs As Excel.Workbooks
Dim FileSpec As String = "E:\Documents and Settings\Rick\My
Documents\Visual Studio Projects\DriveExcel\PIData.xls"
oXL = CreateObject("Excel.Application") '***How to specify Excel
2000?
oXL.Visible = True
oWkbs = oXL.Workbooks
oWkb = oWkbs.Open(FileSpec)

End Sub



NewsNet

COM interop XL2000 vs 2003
 
Rick,
oXL = CreateObject("Excel.Application.9") 'XL2000
oXL = CreateObject("Excel.Application.10") 'XL2003 ??

NickHK

"Rick Humphrey" ...
Hi,

I am attempting to use VB.net to drive Excel 2000. So I add reference in
my
project to MS XL Object Library 9.0... Everything is great, except here is
the issue....
The Box I'm developing on has Excel2000 & Excel2003 installed..... I want
to
develop and deploy the project to the Excel2000 environment..... Is there
an
easy way when I create the Excel.Application object to force it to open
Excel
2000 and not Excel 2003?

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOpen.Click
Dim oXL As Excel.ApplicationClass
Dim oWkb As Excel.WorkbookClass
Dim oWkbs As Excel.Workbooks
Dim FileSpec As String = "E:\Documents and Settings\Rick\My
Documents\Visual Studio Projects\DriveExcel\PvIData.xls"
oXL = CreateObject("Excel.Application") '***How to specify Excel
2000?
oXL.Visible = True
oWkbs = oXL.Workbooks
oWkb = oWkbs.Open(FileSpec)

End Sub





RB Smissaert

COM interop XL2000 vs 2003
 
I think I remember from somewhere that doing that doesn't (reliably or maybe
not at all)
force the Excel version you want.
By the way Excel 2003 is version 11, 2002 (XP) is 10.

RBS

"NewsNet" wrote in message ...
Rick,
oXL = CreateObject("Excel.Application.9") 'XL2000
oXL = CreateObject("Excel.Application.10") 'XL2003 ??

NickHK

"Rick Humphrey"
...
Hi,

I am attempting to use VB.net to drive Excel 2000. So I add reference in
my
project to MS XL Object Library 9.0... Everything is great, except here
is
the issue....
The Box I'm developing on has Excel2000 & Excel2003 installed..... I want
to
develop and deploy the project to the Excel2000 environment..... Is there
an
easy way when I create the Excel.Application object to force it to open
Excel
2000 and not Excel 2003?

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOpen.Click
Dim oXL As Excel.ApplicationClass
Dim oWkb As Excel.WorkbookClass
Dim oWkbs As Excel.Workbooks
Dim FileSpec As String = "E:\Documents and Settings\Rick\My
Documents\Visual Studio Projects\DriveExcel\PvIData.xls"
oXL = CreateObject("Excel.Application") '***How to specify Excel
2000?
oXL.Visible = True
oWkbs = oXL.Workbooks
oWkb = oWkbs.Open(FileSpec)

End Sub






Dove

COM interop XL2000 vs 2003
 
Rick,

Interesting question... I can think of two possibilities to try as it
appears you have the right reference added.

1) What happens when you have Excel2000 open and you run your code? If
this works, you can start up an instance of it before opening the file then
closing the extra blank workbook if it gets in the way.

2) What happens if you tell windows to associate .xls files (or the file
extension you are using) to open with the Excel2000 version? Note, this may
cause problems later with opening files created in Excel2003. You may need
to toggle this programatically (not sure how it would be done in .net)
before/after opening what you need if it works.

David

"Rick Humphrey" wrote in message
...
Hi,

I am attempting to use VB.net to drive Excel 2000. So I add reference in
my
project to MS XL Object Library 9.0... Everything is great, except here is
the issue....
The Box I'm developing on has Excel2000 & Excel2003 installed..... I want
to
develop and deploy the project to the Excel2000 environment..... Is there
an
easy way when I create the Excel.Application object to force it to open
Excel
2000 and not Excel 2003?

Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOpen.Click
Dim oXL As Excel.ApplicationClass
Dim oWkb As Excel.WorkbookClass
Dim oWkbs As Excel.Workbooks
Dim FileSpec As String = "E:\Documents and Settings\Rick\My
Documents\Visual Studio Projects\DriveExcel\PIData.xls"
oXL = CreateObject("Excel.Application") '***How to specify Excel
2000?
oXL.Visible = True
oWkbs = oXL.Workbooks
oWkb = oWkbs.Open(FileSpec)

End Sub






All times are GMT +1. The time now is 06:40 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com