none
Excel com exception, registry key lacking values {000208D5-0000-0000-C000-000000000046} RRS feed

  • Question

  • I have a problem when trying to use excel functions within my program.

    First off, there's nothing wrong with the code itself or any references. I've already included everything that is necessary and a colleague of mine have tried this code on his computer and it works there. The problem lies within my registry keys. 

    Beneath is the reference in QD:

    <I CANT ADD IMAGES SINCE MY ACCOUNT ISN'T VERIFIED YET AND I CAN'T REALLY SIT AROUND AND WAIT FOR THAT SO I'LL JUST EXPLAIN IT IN TEXT>

    The reference is "Microsoft.Office.Interop.Word" Description is Microsoft Word 16.0 Object Library. Identity is: "{00020905-0000-0000-C000-000000000046}\8.7\0\primary". Version 8.7.0.0.

    When I run my program I get this error:

    <ONCE AGAIN THERE SHOULD BE AN IMAGE HERE>

    "System.InvalidCastException: 'Det går inte att omvandla COM-objekt av typen Microsoft.Office.Interop.Excel.ApplicationClass till gränssnitt av typen Microsoft.Office.Interop.Excel._Application. Den här åtgärden misslyckades eftersom QueryInterface-anropet i COM-komponenten för gränssnittet med IID {000208D5-0000-0000-C000-000000000046} misslyckades på grund av följande fel: Gränssnittet har inte registrerats (Undantag från HRESULT:0x80040155).'"

    Sorry for the swedish, but in general it complains that the Query interface call failed in the com component due to the related IID weren't registered  {000208D5-0000-0000-C000-000000000046}.

    I looked up the {000208D5-0000-0000-C000-000000000046} key and found them twice, once in "Dator\HKEY_CLASSES_ROOT\WOW6432Node\Interface\" and one in "Dator\HKEY_CLASSES_ROOT\Interface\". As I understand the WOW6432Node is for the 64bit installation of office and the other is for the 32 bit installation?

    <THERE SHOULD BE AN IMAGE HERE DISPLAYING REGEDIT WITH A KEY AND VALUES, I'LL TYPE IT BELOW MANUALLY AS I CAN'T ADD IMAGES:>

    Dator\HKEY_CLASSES_ROOT\Interface\{000208D5-0000-0000-C000-000000000046}
        TEXT DATA: "_Application"
    
    Dator\HKEY_CLASSES_ROOT\Interface\{000208D5-0000-0000-C000-000000000046}\ProxyStubClsid32
        (Standard): {00020424-0000-0000-C000-000000000046}
    
    Dator\HKEY_CLASSES_ROOT\Interface\{000208D5-0000-0000-C000-000000000046}\TypeLib
        (Standard): {00020813-0000-0000-C000-000000000046}
        Version: 1.9

    <SECOND KEY ENTRY>

    Dator\HKEY_CLASSES_ROOT\WOW6432Node\Interface\{000208D5-0000-0000-C000-000000000046}
        (Standard): No value has been given
    
    Dator\HKEY_CLASSES_ROOT\WOW6432Node\Interface\{000208D5-0000-0000-C000-000000000046}\ProxyStubClsid32
        (Standard): <empty>
    
    Dator\HKEY_CLASSES_ROOT\WOW6432Node\Interface\{000208D5-0000-0000-C000-000000000046}\TypeLib
        (Standard): <empty>

    Above are the two keys, but the WOW64 version has no values tied to its strings plus its missing the version string, it's this that is causing my error (I presume). I tried just changing (just for the fun of it) the value of the WOW64 version to the same values as the Interface one, and then I got another error telling me that these pointers where invalid. I mostly just did this to see if WOW64 node actually were the one my program tries to access, and it seems it is.

    I've also uninstalled office and reinstalled it completely, I've also done repair on office, both the normal one and the online repair. None fixes the problem.

    So right now I'm stuck here not getting anywhere because the key's values are empty and I don't know what they are supposed to contain, and office reinstallations won't fill them correctly when re-installing or repairing.

    There also is a problem with my "{00020905-0000-0000-C000-000000000046}" key (the one connected to Interop reference), it contains both 8.6 and 8.7 keys but the 8.6 one contains null values and says I can't read from it, and I know this has been a problem for others when programming with Excel. It seems to contain a nullvalue that stops me from deleting and reading it properly. I've tried running a program that's supposed to put my user account as the owner of this key, but that doesn't do much, and I've also run a program that's supposed to clear nullvalues but it didn't do much to clear my error.

    Apart from that I've also tried exporting the parent key, then edit the content. By doing that I can make it so that I can actually access the 8.6 key and read it's values, but if I try to remove it it still complains. Though this is a latter issue, or it might not even be an issue if the first one is resolved.

    Any help regarding this would be nice. At the moment I'm stuck with not being able to use excel in my programming as I can't get past this error, and the help I've searched for online haven't done much for me.

    Also sorry if this is in the wrong section since it's not really about C# coding directly.

    Friday, November 22, 2019 10:23 AM

All replies

  • Are you compiling with the following and if not try this configuration.


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    Friday, November 22, 2019 11:38 AM
    Moderator
  • Hi Bikkebakke,

    Thank you for posting here.

    This problem may be caused by the failure to clean up the registry when uninstalling the previous version of Office.

    This is a link that details how to solve this problem.

    0x80029C4A (TYPE_E_CANTLOADLIBRARY)

    Hope this could be helpful.

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, November 25, 2019 5:32 AM
  • Hi.

    I'll check out the link and their answer and report back here if it solved it. Thank you meanwhile.

    Monday, November 25, 2019 6:57 AM
  • I just want to add that I still have problems, but I haven't delved that deep into it as well.

    I tried following steps similar to how the link Timon Yang above gave it but couldn't get it to work:

    So right now I'm sort of just giving up with this and switch from .xlsx to .csv instead.

    Tuesday, December 3, 2019 2:23 PM
  • I'm going to add a final update.

    I never solved this issue, most likely my registry keys were absolutely messed up.

    However; My computer had to be re-imaged due to other reasons, and when that happened I got a proper working Office installation that fixed everything, so I could use the library as it should.

    So no solution sadly for the problem itself sadly, or well, no solution other than re-installing windows and office.

    Thursday, March 5, 2020 12:04 PM