none
suddenly, "automation error. Library not registered"

    Question

  • I developed an Access Application (Office 2003, 'simple' VBA, no .Net) and in an event handler I've:

      Dim oXsl As Excel.Application
    
       ' ...
    
      Set oXsl = New Excel.Application
    and I read an excel file without any problem
    I HAVE read till yesterday: now, suddenly, I get the error on the line where I instance Excel

    The Excel reference is right, I haven't modified nothing.
    The file mdb is in the same location as yeterday. I can't understand, and, above all, I can't imagine where to look for the cause. MSDN search gave me no applicable (or no understandable as applicable) results.

    I hope you can help me, because my work is blocked. Thanks in advance

    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    Monday, March 8, 2010 3:32 PM

Answers

  • I had this same problem (but with Excel 2007), and have now fixed it.  It is caused by having references to multiple versions of Excel in the registry, and automation defaulting to one that is no longer installed.

    In my case, I have Office 2007 installed, then upgraded to 2010, then uninstalled 2010 and re-installed Office 2007.  I still have OneNote 2010 installed (but that's the only thing from Office 2010) - and probably because of this every now and again bits of Office 2010 reappear in the registry and corrupt the Office 2007 install.  Reinstalling Office 2007 does not fix it - perhaps uninstalling Office 2010 completely would, but it might not (and that's not a possibility for me).

    The fix for the issue is hinted at here, for the same issue with Outlook:

    http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/9128583b-ddb6-4628-8085-1e6849f35c7f

    To fix it in Excel, what I did was do a search through the registry for registry data containing "Microsoft.Office.Interop.Excel" (since registry key in the above post relates to Outlook throwing the error rather than Excel).  Since I only have Excel 2007 installed, then all references should be to Version 12.0.0.0 (2007) - I deleted the entire registry key for any entries that had references to Version 14.0.0.0 (2010), which is not installed.  As soon as I did this, my macro started working again.

    Incidentally, this issue also causes Adobe Acrobat 9 to fail (Explorer integration - i.e. right-click-->convert to Acrobat PDF - will no longer work).  

    Monday, June 27, 2011 1:51 AM

All replies

  • Hello.

    Did you try to register again the dll ?

    Regards.

    Daniel
    Monday, March 8, 2010 4:37 PM
  • Check References to make sure that Microsoft Office Excel is still selected. Since you are using early binding, this is required.

    Monday, March 8, 2010 7:01 PM
  • Yes, it's ok (excel9.olb). On the contrary, I can't write 'Excel.Application'
    Excel works, if I open any xls file. It's the automation from VBA that doesn't.
    My application still works on clients. Only (I hope :o)) on my PC it doesn't.
    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    Tuesday, March 9, 2010 7:46 AM
  • Yes, without getting out.
    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    Tuesday, March 9, 2010 7:46 AM
  • Whats the error you are getting?

    Have you check event log for any strange errors?

    When you estart Excel directly do you have any problems?

    Have you installed any updates recently?

    Cheers
    Please remember to mark the replies as answers if they help you.
    Wednesday, March 10, 2010 12:59 PM
  • Hi.

    Got the same error with Word 2003, then Word 2007. It disappeared with Office 2010 setup. Never found an explanation, only guys with the same problem and no clue.

    Hope it will not be the same for you.

    Regards.

    Daniel
    Wednesday, March 10, 2010 1:09 PM
  • I had this same problem (but with Excel 2007), and have now fixed it.  It is caused by having references to multiple versions of Excel in the registry, and automation defaulting to one that is no longer installed.

    In my case, I have Office 2007 installed, then upgraded to 2010, then uninstalled 2010 and re-installed Office 2007.  I still have OneNote 2010 installed (but that's the only thing from Office 2010) - and probably because of this every now and again bits of Office 2010 reappear in the registry and corrupt the Office 2007 install.  Reinstalling Office 2007 does not fix it - perhaps uninstalling Office 2010 completely would, but it might not (and that's not a possibility for me).

    The fix for the issue is hinted at here, for the same issue with Outlook:

    http://social.msdn.microsoft.com/Forums/en/vbgeneral/thread/9128583b-ddb6-4628-8085-1e6849f35c7f

    To fix it in Excel, what I did was do a search through the registry for registry data containing "Microsoft.Office.Interop.Excel" (since registry key in the above post relates to Outlook throwing the error rather than Excel).  Since I only have Excel 2007 installed, then all references should be to Version 12.0.0.0 (2007) - I deleted the entire registry key for any entries that had references to Version 14.0.0.0 (2010), which is not installed.  As soon as I did this, my macro started working again.

    Incidentally, this issue also causes Adobe Acrobat 9 to fail (Explorer integration - i.e. right-click-->convert to Acrobat PDF - will no longer work).  

    Monday, June 27, 2011 1:51 AM
  • Thanks to all of you. At the end, I've installed office 2007 and I hope to have this problem no longer.


    please, mark this as answer if it is THE answer
    ----------------
    Diego Cattaruzza
    Microsoft MVP - Visual Basic: Development
    blog: http://community.visual-basic.it/Diego
    web site: http://www.visual-basic.it
    Monday, August 1, 2011 12:50 PM
  • I am using Office 2010 - suddenly i also got this error yesterday and trying ... trying to solve this.... without know how to solve.
    Saturday, February 4, 2012 12:35 PM
  • Hi,

    Solution suggested by Denis Cheong is good. I had MS Excel 2003 installed, then 2007, then 2010 x64, then uninstalled 2010 and eventually only MS Excel 2007 was the only version installed on my laptop (Win 7 x64, by the way). The line code Set xls = New Excel.Application worked fine in IDE VB6, but suddenly it is occured this method is failed with Err.Description like "Automation error. Library not registered".

    My fix was removing entry "1.7" which was referenced to 14.0.0.0 (Excel 2010) in registry key

    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\TypeLib\{00020813-0000-0000-C000-000000000046}

    After that as I think the only way to get reference on "Microsoft.Office.Interop.Excel" lib became "1.6" entry with reference to 12.0.0.0 version.

    Thanks :)

    • Proposed as answer by Flores Toon Monday, August 13, 2012 8:19 AM
    Wednesday, February 22, 2012 5:21 PM
  • I had installed Office 2010, and after installing and deinstalling Office 2013 I got the "Automation error. Library not registered."

    The fix for 32 bits Office 2013/2010, delete the key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.8

    • Proposed as answer by QuimaxW Tuesday, August 28, 2012 4:59 PM
    Monday, August 13, 2012 8:26 AM
  • Well done Flores Toon... your fix worked!!!!  I also installed Office 2013 and uninstalled it and then got this error.

    Thanks for your help!

    Tuesday, August 14, 2012 6:30 AM
  • I had installed Office 2010, and after installing and deinstalling Office 2013 I got the "Automation error. Library not registered."

    The fix for 32 bits Office 2013/2010, delete the key:

    HKEY_LOCAL_MACHINE\SOFTWARE\Classes\TypeLib\{00020813-0000-0000-C000-000000000046}\1.8

    Worked, uninstalled office 2013 as well.
    Wednesday, September 5, 2012 6:28 PM
  • I finally found something that worked for this problem.  I tried the following steps and they worked,

    Step 1. Go to Run Prompt and Type “regedit” and click ok
    Step 2. Expand HKEY_LOCAL_MACHINE
    Step 3. Expand Classes
    Step 4. Expand TypLib
    Step 5. Expand 00020813-0000-0000-C000-000000000046
    Step 6. Select 1.8
    Step 7. Right Click on 1.8 and Delete this. 


    Brad C. Parris Sr. IT Manager Custom Solutions

    Wednesday, January 11, 2017 7:11 PM