Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Two excel version conflict?

it's C# code, I am not sure if this is the right place...
please let me know if there're somewhere else I can put this question to...

"feather" wrote:

my program worked fine with excel 2002, but when my user installed an old
excel version 2000 (i.e. the user has 2002 and 2000 on his pc now), my
program throw exception when calling the open function...please help...

my code:

oExlApp = new Excel.Application();
oExlApp.Visible = false;
oExlWB = (Excel._Workbook) oExlApp.Workbooks.Open(strSrcFileName,
Missing.Value, true, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value , Missing.Value);

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Two excel version conflict?

From what I understand about C# (not much), all arguments must be included,
unlike VB/VBA where optional arguments can be omitted.
As the newer version has extra (optional) arguments compared to the older
version, these call will fail.
Maybe you need late binding and test the version of Excel to decide which
calls to make.

But it is generally advised to develop on the oldest system you intend
support.

NickHK

"feather" wrote in message
...
it's C# code, I am not sure if this is the right place...
please let me know if there're somewhere else I can put this question

to...

"feather" wrote:

my program worked fine with excel 2002, but when my user installed an

old
excel version 2000 (i.e. the user has 2002 and 2000 on his pc now), my
program throw exception when calling the open function...please help...

my code:

oExlApp = new Excel.Application();
oExlApp.Visible = false;
oExlWB = (Excel._Workbook) oExlApp.Workbooks.Open(strSrcFileName,
Missing.Value, true, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,

Missing.Value,
Missing.Value, Missing.Value, Missing.Value , Missing.Value);



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Two excel version conflict?

when I develop & deploy my program, the user have the same enviroment as me,
only excel 2002. After a while, he installed 2000 to open some perticular xls
file which have some function only available under 2000 (no idea what it
is...). Anyway, that's why I got this issue.

Yes I think late binding is a good idea, could you tell me how to do this in
C#?

Thanks a lot!

"NickHK" wrote:

From what I understand about C# (not much), all arguments must be included,
unlike VB/VBA where optional arguments can be omitted.
As the newer version has extra (optional) arguments compared to the older
version, these call will fail.
Maybe you need late binding and test the version of Excel to decide which
calls to make.

But it is generally advised to develop on the oldest system you intend
support.

NickHK

"feather" wrote in message
...
it's C# code, I am not sure if this is the right place...
please let me know if there're somewhere else I can put this question

to...

"feather" wrote:

my program worked fine with excel 2002, but when my user installed an

old
excel version 2000 (i.e. the user has 2002 and 2000 on his pc now), my
program throw exception when calling the open function...please help...

my code:

oExlApp = new Excel.Application();
oExlApp.Visible = false;
oExlWB = (Excel._Workbook) oExlApp.Workbooks.Open(strSrcFileName,
Missing.Value, true, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,

Missing.Value,
Missing.Value, Missing.Value, Missing.Value , Missing.Value);




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default Two excel version conflict?

That's a question for a C# NG.
In VB/VBA, you do not set a reference and only use the generic Object
variable with CreateObject:

Dim XLApp as object
set xlapp=createobject("Excel.Application")
'etc

NickHK

"feather" wrote in message
...
when I develop & deploy my program, the user have the same enviroment as

me,
only excel 2002. After a while, he installed 2000 to open some perticular

xls
file which have some function only available under 2000 (no idea what it
is...). Anyway, that's why I got this issue.

Yes I think late binding is a good idea, could you tell me how to do this

in
C#?

Thanks a lot!

"NickHK" wrote:

From what I understand about C# (not much), all arguments must be

included,
unlike VB/VBA where optional arguments can be omitted.
As the newer version has extra (optional) arguments compared to the

older
version, these call will fail.
Maybe you need late binding and test the version of Excel to decide

which
calls to make.

But it is generally advised to develop on the oldest system you intend
support.

NickHK

"feather" wrote in message
...
it's C# code, I am not sure if this is the right place...
please let me know if there're somewhere else I can put this question

to...

"feather" wrote:

my program worked fine with excel 2002, but when my user installed

an
old
excel version 2000 (i.e. the user has 2002 and 2000 on his pc now),

my
program throw exception when calling the open function...please

help...

my code:

oExlApp = new Excel.Application();
oExlApp.Visible = false;
oExlWB = (Excel._Workbook) oExlApp.Workbooks.Open(strSrcFileName,
Missing.Value, true, Missing.Value, Missing.Value,

Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,

Missing.Value,
Missing.Value, Missing.Value, Missing.Value , Missing.Value);






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Two excel version conflict?

I suspect the user erred in thinking he had to install 2000. There were
additions from 2000 to 2002, but I don't know of any lost functions.

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
http://PeltierTech.com
_______


"feather" wrote in message
...
when I develop & deploy my program, the user have the same enviroment as
me,
only excel 2002. After a while, he installed 2000 to open some perticular
xls
file which have some function only available under 2000 (no idea what it
is...). Anyway, that's why I got this issue.

Yes I think late binding is a good idea, could you tell me how to do this
in
C#?

Thanks a lot!

"NickHK" wrote:

From what I understand about C# (not much), all arguments must be
included,
unlike VB/VBA where optional arguments can be omitted.
As the newer version has extra (optional) arguments compared to the older
version, these call will fail.
Maybe you need late binding and test the version of Excel to decide which
calls to make.

But it is generally advised to develop on the oldest system you intend
support.

NickHK

"feather" wrote in message
...
it's C# code, I am not sure if this is the right place...
please let me know if there're somewhere else I can put this question

to...

"feather" wrote:

my program worked fine with excel 2002, but when my user installed an

old
excel version 2000 (i.e. the user has 2002 and 2000 on his pc now),
my
program throw exception when calling the open function...please
help...

my code:

oExlApp = new Excel.Application();
oExlApp.Visible = false;
oExlWB = (Excel._Workbook) oExlApp.Workbooks.Open(strSrcFileName,
Missing.Value, true, Missing.Value, Missing.Value, Missing.Value,
Missing.Value, Missing.Value, Missing.Value, Missing.Value,

Missing.Value,
Missing.Value, Missing.Value, Missing.Value , Missing.Value);






Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I save an Excel 97-2003 version or 2007 version for Mac 200 Bronigal Excel Discussion (Misc queries) 1 December 7th 09 08:04 AM
Excell Version Conflict Mian_Ghous Excel Worksheet Functions 0 November 19th 07 05:26 AM
Recover earlier version of excel sheet after new version saved? stephanie38 Excel Discussion (Misc queries) 3 June 17th 05 03:52 AM
How can I update the version of Excel 2000 9.0 to version 10.0 Ramsey Can Excel Discussion (Misc queries) 1 May 11th 05 03:28 PM
Calendar control version conflict? clayton[_7_] Excel Programming 0 February 27th 04 04:05 PM


All times are GMT +1. The time now is 10:18 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"