"Object library invalid or contains references to object definitions that could not be found" or "Element not found"


After installing security advisory 960715 and opening a workbook with one of Visual Basic 6 ActiveX controls embedded in the workbook you receive an error:

This blog is inactive.
New blog: EricWhite.com/blog

Blog TOC
“Object library invalid or contains references to object definitions that could not be found” or “Element not found.”

For more information, see this post on the Visual Studio Office Developer Team’s blog.   We want to get this message out to the most people possible.

Comments (59)

  1. Denis says:

    I am getting multiple errors on Excel 2010. My OS is Win7 and Office was upgraded from 2007 to 2010 32bit:

    Microsoft Visual Basic for Applications: Complie error in hidden module: Main. This error commonly occurs when code is incompatible with the version, platform, or architecture of this applicaton. Click "Help" for information on how to correct this error.

    Microsoft Visual Basic for Applications: Object library invalid or contains references to object definitions that could not be found.

    (on closing Excel 2010 only) Microsoft Visual Basic for Applications: Compile error in hidden module: mod Addin. This error commonly occures when code is incompatible with the version, platform, or architecture of this applications. Click "Help" for information on how to correct this error.

  2. Stephen D. Oliver says:

    Denis,

    Sounds like an Add-in is causing the issue. I would troubleshoot which one by clicking the File tab, clicking Options, clicking Add-Ins, selecting COM Add-Ins under Manage, and then clicking Go…  Uncheck all the Add-ins that load on Startup and then click OK. Close Excel 2010. Then, go back into the same COM Add-Ins dialog and check one Add-in and then click OK. Restart Excel. If you get the error message, then it's that Add-In that's causing the problem.

  3. Abbas Mohamed says:

    1. Open the command prompt.

    2. Navigate Document and Settings

    3. C:Documents and Settings>del /S /A:H /A:-H *.EXD (and press enter key)

  4. Steve says:

    Abbas Mohamed – thank you the excellent advise on solving the above problem. I shall save this to my support information file.

    Regards

    Steve

  5. Santosh says:

    Hi Abbas,

    This didn't solve my issue.I'm still receiving this error!

  6. Larry says:

    Abbas…solved my problem with Execl 2010 on Windows XP Professional…thank you.

  7. Prasad says:

    Thanks Abbas for the perfect solution.

  8. Jerome says:

    Hello all

    The solution proposed by Abbas Mohamed

    1. Open the command prompt.

    2. Navigate Document and Settings

    3. C:Documents and Settings>del /S /A:H /A:-H *.EXD (and press enter key)

    Does not worked for me.

    Each time the files are deleted. Each they are showing again when I try to open my Excel file.

    Any other idea ?

    Thanks

  9. Excellent Abbas Mohamed.. thanks for your help says:

    Excellent Abbas Mohamed.. thanks for your help…. now itz not error out…

  10. Debobrata says:

    Thanks Abbas. The problem is resovled.

  11. Carolina says:

    There is no c:documents and settings for windows 7…

  12. Raul says:

    Thanks Stephen D. Oliver

    I had this error with Excel and it WAS the Add In I had installed, I could not repair it so i had to remove the add-in and problem has been resolved

  13. fermon says:

    One way to work around this is to explicitly add the reference to the controls:

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

  14. chandra says:

    1. Open the command prompt.

    2. Navigate Document and Settings

    3. C:Documents and Settings>del /S /A:H /A:-H *.EXD (and press enter key)

    This worked for me. Thanks.

    May I know what exactly you are trying to do with the command.

  15. Nathalie says:

    the solution:

    One way to work around this is to explicitly add the reference to the controls:

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

    Worked for me

  16. Ninad says:

    Thanks Fermon, it worked fine.

    The issue had started since i uninstalled Microsoft Project Plan 2011 and i have Office 2003

  17. Giank says:

    Hi to all,

    I just try to find all the *.EXD from the all drive C searching, and move them in other location like C:Temp or C:Documents.

    With his modification the problem was resolved.

    I hope this could help to someone.

    Regards!

  18. George says:

    My problem is with Excel 2007 the issue of Object Library invalid it still for me, the other problem is for saving it will show error that wont able to save.

  19. Simontrigowhite says:

    Thank you Nathalie, your solution worked for me!

  20. Linus says:

    When using Windows 7, use a file manager like Windows Explorer to go into the user specific directory "%AppData%RoamingMicrosoftForms" and delete the EXD-files "RefEdit.exd" and "MSComctlLib.exd"

    I am focus on window based testing. If you are interested, please contact me z_yu_t@hotmail.com

  21. Raghu says:

    1. Open the command prompt.

    2. Navigate Document and Settings

    3. C:Documents and Settings>del /S /A:H /A:-H *.EXD (and press enter key)

    This worked for me, Thanks!

  22. KB says:

    you are a STAR Abbas Mohamed..it works like a charm

  23. Celestique says:

    Linus:  Perfect!  Worked like a charm for Win 7. Thank you.

  24. Jennifer says:

    Linus, you are my hero. So many solutions that worked in the past have not been working this week. Yours finally resolved the issue. Much appreciated!

  25. Dan says:

    Thanks to Linus!

    Windows 7 users, his solution worked for me:

    When using Windows 7, use a file manager like Windows Explorer to go into the user specific directory "%AppData%RoamingMicrosoftForms" and delete the EXD-files "RefEdit.exd" and "MSComctlLib.exd"

  26. Omega says:

    any way to script this fix and push it to thousands of pcs? or a hotfix?

  27. 1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

    This also worked for me. Thanks.

  28. Nalin says:

    Thanks Abbas for your help .. it worked like magic

  29. Saurabh says:

    For windows 7, This worked for me like a charm:

    Linus 18 Apr 2012 3:08 AM

    When using Windows 7, use a file manager like Windows Explorer to go into the user specific directory "%AppData%RoamingMicrosoftForms" and delete the EXD-files "RefEdit.exd" and "MSComctlLib.exd"

  30. Bipul Shukla says:

    Excellent Abbas – Works for me. I was in the middle of an important Oracle BI Publisher deliverable which works over Microsoft Word & I was unable to open the tags.

    Thanks a ton 🙂

  31. Sudhu says:

    Thanks Abbas. That solved my problem too

  32. Trevor says:

    Abbas Mohamed solved my issue. Thanks

  33. Roberto Fdez says:

    the solution:

    One way to work around this is to explicitly add the reference to the controls:

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

    Worked for me

  34. Lochana Pad says:

    Thanks Abbas, for the perfect solution. It works for Excel 2007 on Windows XP professional.

  35. Samyuktha says:

    Thanks to Abbas, The solution worked for me too.

  36. Tina Akinradewo says:

    Thanks Abbas, your solution worked perfectly for me. I knew I had to find and delete the exd files (as I had to solve a similar problem in 2009) but was finding it difficult to track them all down. Your solution worked perfectly.

    Thanks a million times.

  37. Matthew N. says:

    Thank you Abbas, that resolved my issue as well. Excel 2007 on Windows XP.

  38. Chandrashekha D. says:

    Its working fine, realy helpfull command.

  39. Suraj says:

    the solution:

    One way to work around this is to explicitly add the reference to the controls:

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

    Worked for me

  40. Rob says:

    The solution:

    When using Windows 7, use a file manager like Windows Explorer to go into the user specific directory "%AppData%RoamingMicrosoftForms" and delete the EXD-files "RefEdit.exd" and "MSComctlLib.exd"

    Worked for me,

    Thanks!

  41. Hooman says:

    Abbas Mohamed- thank you it worked fine.

  42. champ says:

    The solution below worked from me . Thank you Fermon .

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

  43. Ranjit says:

    Worked Abbas steps for me in Windows XP with Office 2007

    Thanks Abbas

  44. Prabhakar says:

    Thanks Fermon… worked… Excellent…

  45. Amit Patel says:

    Thanks Abbas. That solved my problem too

  46. Ramesh Kumar says:

    Mentioned Command worked for me.

    Thanks.

  47. Harish says:

    Thanks Abbas Mohamed. Problem Solved.

    As for what it does :

    I believe some .EXD files are deleted. (http://www.fileinfo.com/…/exd)

    I read a blog saying that it is safe to delete these files as new ones compatible with version of excel will be created

    http://www.treeplan.com/object-library-invalid-error.htm

    thanks once again Abbas

  48. jacky lung says:

    in window 7 try to run the same under C:users instead

  49. nat says:

    Fermon, many thanks! your solution worked for me!

    1. Open the .xls file in question and click OK after getting the error mentioned above.

    2. Open the Visual Basic Editor (Alt+F11)

    3. Open (if they are not already open) one of the modules or code behind forms

    4. Click on Tools / References…

    5. In the pop-up window click on Browse…

    6. Navigate to [Your Windows Directory]System32 (it may open by default)

    7. Type MSCOMCTL.OCX (you'll see it in the auto-select options before you finish typing)

    8. Click Open and the reference will appear as Microsoft Windows Common Controls 6.0 (SP6)

    9. Click on DebugCompile VBAProject to verify that the problem is solved

    10. Save the file.

  50. K.Prasanna says:

    Hi. I'm unable to run visual basic on Windows 7 Home Premim. I'm getting an error saying,"Object library invalid or contains references to object definitions that could not be found" or "Element not found". I've tried all the solution steps given in this blog. Can somebody help me resolving my issue?

  51. GC says:

    Thanks Abbas. It worked. using win xp & office 2010.

  52. Ganesh S says:

    Thanks Abbas. That solved my problem too

  53. Samuel says:

    Saurabh comment works perfectly in window 8, ms office 2010

  54. Aleem says:

    fixed issue by replacing MSCOMCTL.OCX file on System32 folder from a working pc

  55. Dasharath says:

    unregister and then register "MSCOMCTL.OCX"

    Path: 32-Bit OS C:WindowsSystem32MSCOMCTL.OCX

    64-Bit OS C:WindowsSySWOW64MSCOMCTL.OCX

  56. Saravana Pradeesh says:

    Follow this link.Problem solved.

    support.microsoft.com/…/2703186

  57. Kharis says:

    I Have Microsoft PPT 2013 And It Is Not Working and its says

    Object library invalid or contains references to object definitions that could not be found

  58. Prem says:

    I facing the problem even after I add the MSCOMCTL.OCX in reference.

  59. Kodak says:

    I solved it by uploading fresh fm20.dll to the client