none
Error 80040154

    Question

  •  

    Hi all

     

    I'm creating an ASP.NET app in C# which references the Excel 11.0 dll. The dll isn't is the Global Assembly Cache, it's copied right into the Bin folder of the application.

     

    When I click a button which runs code which uses the dll, I get the following error:

     

    Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154.

    I've googled this a bit and the problem may be to do with other dlls required by the Excel one not being there. I have downloaded ProcessExplorer from sysinternals.com and this indicates that the Excel dll is being used by the worker process.

     

    Can anyone suggest how I would find out what other dlls might be necessary? Or do you think something else may be causing the error?

     

    Thanks

     

    David

    Monday, December 03, 2007 4:34 PM

Answers

  • So it sounds to me that you are basically violating a copyright, as it sounds like you are trying to manually copy Excel binaries around rather than actually install it like you would be required to do.

    Do the right thing: If your application requires Excel, then Excel is required to be installed on the target machine, the correct way, not by you hijacking it.

     

    Monday, December 03, 2007 5:50 PM

All replies

  • I don't know what the specific error number means, but I suspect you don't have the COM component it is trying to use, actually registered on the machine it is running on.

    Monday, December 03, 2007 4:37 PM
  • Nobody knows what the error number means, it's not really documented anywhere.

     

    Other people on the web who have solved this have done so but identifying a dll which is required by the one they are using, which is absent.

     

    In this case, I have used Dependency Walker (a program tucked away in the Visual Studio folder) to identify that a dll called msjava.dll is apparently required by Microsoft.Office.Interop.Excel, but is missing from my computer.

     

    I can't find an uncorrupted version on the internet however.

    Monday, December 03, 2007 5:30 PM
  • So it sounds to me that you are basically violating a copyright, as it sounds like you are trying to manually copy Excel binaries around rather than actually install it like you would be required to do.

    Do the right thing: If your application requires Excel, then Excel is required to be installed on the target machine, the correct way, not by you hijacking it.

     

    Monday, December 03, 2007 5:50 PM
  • Office is installed on the server! The reason I placed the dll in the project folder and linked to it there is because linking to the one in the global assembly cache wasn't working (same error).

     

    Any other suggestions?

    Wednesday, December 05, 2007 9:34 AM

  • That was the most idiotic post I have read so far in the MSDN forums.

    If there is a solution, email me. I am working in a citrix environment where this is happening. (and yes excel is installed, yes it's licensed, yes it's paid for.... and yes eradicator is a moron.)

    A
    Tuesday, February 05, 2008 6:37 PM
  • Um, not sure who's an idiot, but I managed to get the Excel API working by assigning the appropriate permissions to

    the asp.net worker process.

     

    I found a link which explained how to set the process' permissions over Excel, but the link now appears to be dead:

     

    http://blog.crowe.co.nz/archive/2006/03/02/589.aspx

     

    Hope some of this might help.

     

    David

    Wednesday, February 06, 2008 12:20 PM
  •  Hi,David

    I am Jacky_Bear, I account the same problem as yours , can you help me how to solve it?

    this is my Email xjc389506244@hotmail.com. I will appreciat it , Thank you very much.
    Friday, October 17, 2008 1:17 PM
  • Hey David,

    Ahmed here from Canada. Iam ran into the same problem as you. Excel is installed and i just referenced:

    Interop.Microsoft.Office.Core, Interop.VBIDE, Interop.Excel

    I followed the guide @ http://blog.crowe.co.nz/archive/2006/03/02/589.aspx without success.

    Any suggestion?

    email is: Ahmed.Younis@hrsdc-rhdsc.gc.ca

    Much Appreicated

    -A
    Wednesday, July 29, 2009 5:19 PM
  • I know this was posted a long time ago. I had a typo today and got this error. I realized that a variable was out of context; I corrected, and everything was fine.

    You may be improperly referencing a Workbook object, without, first, referencing the Application object. Or, in generic terms, you may be working with a child that is an orphan.

     

    Make sure your Application object is not nothing.

    Saturday, October 16, 2010 9:40 AM
  • Thanks DaveKlem.  That turned out to be my problem.  I had done a bunch of refactoring and for some reason I ended up with

    excelApp = new ApplicationClass();

    excelWorkbook = new Workbook();//problem

    which resulted in the 80040154 error.

    This is the line that works:

    excelWorkbook = excelApp.Workbooks.Add(Type.Missing);

    • Edited by Kim_71 Wednesday, February 09, 2011 9:33 PM formatting issues
    • Proposed as answer by DotNetter2010 Wednesday, May 01, 2013 3:08 PM
    Wednesday, February 09, 2011 9:28 PM
  • Any other answer??

    Thursday, August 09, 2012 8:56 AM
  • Thanks a ton Kim! You really saved me lot of time .. thank you!!
    Wednesday, May 01, 2013 3:08 PM