Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automation multiversion excel 2003-2007

Hi lads.
I use simple excel automation im my c# 2.0 app.
I do it like in MS samples ,add reference to excel com libraries
,createobject ,etc and transfer DataTable to Excel.
But as far as I can see they changed object model in excel
2007 ,so i can't run my app on the PC with excel 2007 installed .
Of course I can change refernce to libraries and make small changes to
the
export functions ,but the modified version will not work on old 2003
excel
PC's
Can you help me with this problem ?
I wanna run my app on both versions

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Automation multiversion excel 2003-2007


Use two sets of code.
Check the application version and run the appropriate code.
Be aware that some XL 2003 code will not work on earlier XL versions.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message
Hi lads.
I use simple excel automation in my c# 2.0 app.
I do it like the MS samples, add reference to excel com libraries,
createobject, etc and transfer DataTable to Excel.
But as far as I can see they changed object model in excel
2007, so i can't run my app on the PC with excel 2007 installed.
Of course I can change refernce to libraries and make small changes to
the export functions, but the modified version will not work on old
2003 excel PC's
Can you help me with this problem ?
I want to run my app on both versions

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Automation multiversion excel 2003-2007


Jim Cone wrote:
Use two sets of code.
Check the application version and run the appropriate code.
Be aware that some XL 2003 code will not work on earlier XL versions.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message
Hi lads.
I use simple excel automation in my c# 2.0 app.
I do it like the MS samples, add reference to excel com libraries,
createobject, etc and transfer DataTable to Excel.
But as far as I can see they changed object model in excel
2007, so i can't run my app on the PC with excel 2007 installed.
Of course I can change refernce to libraries and make small changes to
the export functions, but the modified version will not work on old
2003 excel PC's
Can you help me with this problem ?
I want to run my app on both versions



Thanks a lot ,do you have some sapmle ?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Automation multiversion excel 2003-2007


C# is a foreign language to me, so I am speaking about Excel VBA code only.
(this is not a C# newsgroup)

Assuming you have an object reference to Excel of objAppXL...
'Val is a VBA function that returns the number contained in a string
' as a numeric value of appropriate type
'Version is a string property that returns the application version.
'--
x = Val(objAppXL.Version)
If x < 12 Then
'run xl2003 code
Else
'run xl2007 code
End If
'--
If run from an Office application, you would want the xl2003 code
and the xl2007 code in separate modules to avoid compile problems.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message Jim Cone wrote:
Use two sets of code.
Check the application version and run the appropriate code.
Be aware that some XL 2003 code will not work on earlier XL versions.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message
Hi lads.
I use simple excel automation in my c# 2.0 app.
I do it like the MS samples, add reference to excel com libraries,
createobject, etc and transfer DataTable to Excel.
But as far as I can see they changed object model in excel
2007, so i can't run my app on the PC with excel 2007 installed.
Of course I can change refernce to libraries and make small changes to
the export functions, but the modified version will not work on old
2003 excel PC's
Can you help me with this problem ?
I want to run my app on both versions



Thanks a lot ,do you have some sapmle ?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,582
Default Automation multiversion excel 2003-2007

IMO, you'd want the 2003 and 2007 code in two separate add-ins. Seemingly
more work, but probably easier in the long run.

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


"Jim Cone" wrote in message
...

C# is a foreign language to me, so I am speaking about Excel VBA code
only.
(this is not a C# newsgroup)

Assuming you have an object reference to Excel of objAppXL...
'Val is a VBA function that returns the number contained in a string
' as a numeric value of appropriate type
'Version is a string property that returns the application version.
'--
x = Val(objAppXL.Version)
If x < 12 Then
'run xl2003 code
Else
'run xl2007 code
End If
'--
If run from an Office application, you would want the xl2003 code
and the xl2007 code in separate modules to avoid compile problems.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message Jim Cone wrote:
Use two sets of code.
Check the application version and run the appropriate code.
Be aware that some XL 2003 code will not work on earlier XL versions.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


"bull73"
wrote in message
Hi lads.
I use simple excel automation in my c# 2.0 app.
I do it like the MS samples, add reference to excel com libraries,
createobject, etc and transfer DataTable to Excel.
But as far as I can see they changed object model in excel
2007, so i can't run my app on the PC with excel 2007 installed.
Of course I can change refernce to libraries and make small changes to
the export functions, but the modified version will not work on old
2003 excel PC's
Can you help me with this problem ?
I want to run my app on both versions



Thanks a lot ,do you have some sapmle ?





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Publisher Policies

Bear in mind that when you install office 2007, a publisher policy in the golbal assembly cache will prevent you from using the 2003 primary interop assemblies at runtime. You'll have to circumvent that in some way, or you'll get compatability warnings.
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
Ole Automation and Excel 2007 footer Greborio Robert Excel Worksheet Functions 2 July 5th 09 11:36 AM
Excel 2003 c++ automation problem. Ken Excel Worksheet Functions 0 January 9th 07 12:13 AM
Word 2003 Find/Change Automation from Excel 2003 crashes Excel 200 Joel Berry Excel Programming 9 March 6th 06 10:20 PM
Excel 2003 does not calculate automation add-in functions automati wschaub Excel Programming 1 July 15th 05 04:30 PM
Automation and multiversion of Excel nicgendron[_2_] Excel Programming 1 July 15th 05 12:34 AM


All times are GMT +1. The time now is 10:37 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"