Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Compatibility Excel 2002 and 2000 in automation

Hello,

I have made a windows application in C#, and i automate Excel to print some
data.

On my dev machine i have Office XP installed (Excel 2002) so i get the COM
dll from it, version 10.0 object library.

The application is running well on machines with Excel 2002, the xls file
open and data is inserted in the cells.

But with Excel 2000 the process fail when opening the workbook.

The exception is :
System.NullReferenceException : Object not set to an instance of an object
at Excel.workbooks.Open(...)

Object oMissing = System.Reflection.Missing.Value;

//monXLS = appliXLS.Workbooks.Open(nomFichier, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing);

monXLS = appliXLS.Workbooks.Open(nomFichier, 0, false, 5, "", "", true,
Excel.XlPlatform.xlWindows, "", false, false, 0, false, 0, true);



Is there a way to make it work for both version 2000 and 2002 ?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Compatibility Excel 2002 and 2000 in automation

Hi Michael.
My answer is in VB :)

Work with objects !!!
(Firstly you might want to place the code as in the "dont sample" so it will
be easy to debug, but after you make it work - use objects).

Do:
Dim xlsApp As Object
Set xlsApp = CreateObject("Excel.Application")

Dont:
Dim xlsApp As Excel.Application

HTH
Guy

"Michael" wrote in message
...
Hello,

I have made a windows application in C#, and i automate Excel to print
some data.

On my dev machine i have Office XP installed (Excel 2002) so i get the COM
dll from it, version 10.0 object library.

The application is running well on machines with Excel 2002, the xls file
open and data is inserted in the cells.

But with Excel 2000 the process fail when opening the workbook.

The exception is :
System.NullReferenceException : Object not set to an instance of an object
at Excel.workbooks.Open(...)

Object oMissing = System.Reflection.Missing.Value;

//monXLS = appliXLS.Workbooks.Open(nomFichier, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing, oMissing, oMissing,
oMissing, oMissing, oMissing, oMissing, oMissing);

monXLS = appliXLS.Workbooks.Open(nomFichier, 0, false, 5, "", "", true,
Excel.XlPlatform.xlWindows, "", false, false, 0, false, 0, true);



Is there a way to make it work for both version 2000 and 2002 ?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 108
Default Compatibility Excel 2002 and 2000 in automation

Michael wrote:
Hello,

I have made a windows application in C#, and i automate Excel to
print some data.

On my dev machine i have Office XP installed (Excel 2002) so i get
the COM dll from it, version 10.0 object library.

The application is running well on machines with Excel 2002, the xls
file open and data is inserted in the cells.

But with Excel 2000 the process fail when opening the workbook.



Is there a way to make it work for both version 2000 and 2002 ?


As Guy says, you could late bind, but I would try developing with your
reference set to the lowest version of Excel you expect your app. to
encounter. I would, however, avoid going down to Excel 97 since I have had
all sorts of issues with automating Office97 from .NET and I believe MS
doesn't recommend it.

Rob


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
Backwards Compatibility with Excel 2002 elfregono Excel Discussion (Misc queries) 2 September 1st 08 10:29 PM
Excel 2002 compatibility with earlier versions tomhelle Excel Discussion (Misc queries) 1 April 26th 05 02:17 PM
VBA Compatibility Between Excel 2000 and 2002 Winshent Excel Programming 8 October 13th 04 01:41 PM
VBA - Macro backward compatibility from excel 2002 to excel 2000 Frank Krogh Excel Programming 3 April 2nd 04 07:08 PM
compatibility between excel 2002 and 2003 Douvid Excel Programming 1 January 27th 04 02:33 PM


All times are GMT +1. The time now is 12:06 PM.

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"