Frank Uray

Hi all

I have some trouble with Office (Excel) Interop integration ...

I have a x64 Windows Server System. I have some applications
and they are written in C# 2005 and some of them use excel Interop.
The applications wont run the Interop.Excel Code on this system.
Error message:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.

I guess I need a 64bit Interop.Excel.dll. Am I right If yes, where do I find it

Thanks for any comments!

Best regards
Frank Uray


Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Ken Tucker

Compile the application for the x86 processor







Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi Ken

Thanks for your answer!

I did compile already for x64, it does not help.
The file Interop.Excel.dll is still the same ...

Best regards
Frank Uray




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Ken Tucker

Compile for the x86 processor to make it use the 32bit dll's.





Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi Ken

No, I need it on a x64 system ...
It works fine on 32bit systems compiled for x86.

Best regards
Frank Uray




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Ken Tucker

It will work fine on a 64bit system when compiled as a 32bit application. Until there is a 64bit version of office you will have to do this.




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi Ken

No, it does not work on a x64 system ...
The Error Message (in C# and also SSIS) is:
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154.

It does no matter how I compile ...
It seams other people have this problem also ...

Best regards
Frank Uray




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Sriram Rajamanuri

1) run 'clean' on the project in vs 2005

2) remove the reference to excel (interop and other files). Some times VS adds Office.Core as a reference. Remove that too.(from project->properties->references)

3) add the excel COM object again as a refernce.

4) re compile the project

hope this helps,

sriram






Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi sriram

Thank you for your answer!

Just to make sure that I understand right:
- I have my C# project on a 32bit XP Workstation.
- Compile is set to x64
Do I have to open the solution on the x64 server, install office and add the reference there
If I do not install office I am not able to add reference to excel com objects ...

Best regards
Frank Uray





Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Sriram Rajamanuri

What version of Excel are you trying to compile your app against Following are the excel dll versions (the versions can be seen the project->properties->references->add reference dialog)

1) 5.0 : for Microsoft Excel 5.0 or 7.0
2) 8.0 : for Microsoft Excel 97
3) 11.0: for Excel 2003 PIA, Microsoft Excel 11.0 Object Library
4) 10.0 for corresponds to Office XP

Any of the following solution(s) might work:

Solution1:

1) Change the compile to 'x86' on 32bit machine and recompile the solution

2) Copy the binaries (along with the excel interop DLL) to 64-bit machine.

3) you should be able to run it from there..

Solution2

1) Copy the entire solution to 64-bit machine

2) install MS office (the same version/edition as that on 32-bit machine) on 64-bit machine

3) recompile the app as 'x86' (following steps in my previous post)

I strongly feel that solution #1 should work...

best

sriram






Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Ken Tucker

Just to add to what Sriram wrote. If you develop you application using office 2003 and the target computer use office xp your solution will not work.




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi sriram

Thanks a lot for your answer !

The solution 1 is what I did before and this does not work
in any way ! Always the same Error Message ...

The solution 2 I have to try but normaly I do not want
to install office on a high performance 8-way x64 database server ...

I am using Excel 2003 (11.0 Object Libarary).

Best regards
Frank




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Sriram Rajamanuri

In general, I guess Office 2003 installation would be required on the server (while I understand the reason you not wanting to..). But, look at the following link where MS talks about alternatives for server based automation ..

http://support.microsoft.com/kb/257757/

best,

sriram

btw, if you are trying to just 'read' data from an excel spreadsheet, you may as well try using OLEDB (in which case, no Office installation would be required...). Am sure you are aware of that.....






Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi sriram

Thanks again for your help !

Here just one more little information ...
The Error Message:
"Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80040154."
is raised at this line:
Microsoft.Office.Interop.Excel.Application ObjExcel = new Microsoft.Office.Interop.Excel.Application();

I am using the following dll's:
- Microsoft.Office.Interop.Excel.dll
- Office.dll
- Interop.VBIDE.dll

I am able to compile a little sample project on the x64 server,
but I am unable to run it. It does not make any difference if I set
Platform Target to x86 or x64.

Best regards
Frank




Re: 64-Bit .NET Framework Development. 64bit Office Interop ...

Frank Uray

Hi all

I have now tried to install Excel on the x64 server.
It seams to be a joke but now it works ... I would
say it cannot be the goal to install Excel on Servers !!!

Best regards and thank you
Frank Uray