title: Excel VBA "Automation Error" due to Jan 2016 Office Update, probably caused by MSCOMCTL.OCX (Microsoft Windows Common Controls 6.o (Service Pack 6))
body: <p><strong>Solution</strong></p>
  
  <p>I have added a Treeview Active X Control to one of our spreadsheet, using Microsoft Windows Common Controls 6.0 (Service Pack 6), i.e. <code>MSCOMCTL.OCX</code> which lives in <code>C:\Windows\SysWOW64\</code></p>
  
  <p>KB2881029 (Security Update for Microsoft Office 2010 32-Bit Edition) (MS16-004), pushed out from Microsoft on 2016-01-15 (or thereabouts), installs a new version of <code>MSCOMCTL.OCX</code> (v6.1.98.46) which was "Created" on 2015-12-09, but "Accessed" (i.e. installed on the computer) at the time of the update.</p>
  
  <p>This made the workbook "lose" reference to <code>MSCOMCTL.OCX</code> (quote marks on "lose", because the reference is still ticked but no longer works; the workbook doesn't compile because of "Compile error: Object library feature not supported" or "Automation error").</p>
  
  <p>It seems that the update modifies the following registry key by adding a SubKey 2.0, but leaves it empty, and doesn't register the new <code>MSCOMCTL.OCX</code>:</p>
  
  <pre><code>HKEY_CLASSES_ROOT\TypeLib\{831FDD16-0C5C-11D2-A9FC-000F8754DA1}\
  </code></pre>
  
  <p>Fixing the problem requires three steps:</p>
  
  <ol>
  <li><p><code>MSCOMCTL.OCX</code> needs to be unregistered and re-registered from an elevated command prompt, as follows:</p>
  
  <pre>
  C:\Windows\system32>Regsvr32 /u C:\\Windows\SysWOW64\MSCOMCTL.OCX 
  C:\Windows\system32>Regsvr32 C:\\Windows\SysWOW64\MSCOMCTL.OCX
  </pre>
  
  <p>When registering the new <code>MSCOMCTL.OCX</code> (Version 6.1.98.46) via REGSVR32, a new key is added to the Registry:</p>
  
  <pre>
  KEY_CLASSES_ROOT\TypeLib\{831FDD16-0C5C-11D2-A9FC-000F8754DA1}\2.2
  </pre>
  
  <p>If there was a SubKey named 2.1 already existing, it enters a reference that 2.2 is now the Key for use. But it doesn't do anything to the empty 2.0 SubKey !</p>
  
  <p>If there is a 2.0 (or 2.1 for that matter) SubKey with nothing in it, any object using that OCX should fail to create because it will use the 2.0 (resp 2.1) Version, it can't and didn't check for 2.2 Version.</p></li>
  <li><p>Clean up the registry by deleting the wrong or superseded keys 2.0 and 2.1, leaving only the latest and working key 2.2. This can be done from the Registry Editor by selecting HKEY_CLASSES_ROOT, Edit/Find/MSCOMCTRL.OCX.</p>
  
  <p>(Note: this step seems optional as I have checked that doing only step 1 and 3 made the workbook work again. But it feels like the right thing to do)</p></li>
  <li><p>In the in the Excel workbook VBA project, Microsoft Windows Common Controls 6.0 (Service Pack 6) needs to be unreferenced and re-referenced. Re-referencing is not just a matter of re-ticking the box, you need to use "Browse", and select <code>MSCOMCTL.OCX</code> in <code>C:\Windows\SysWOW64\</code></p>
  
  <p>(Note, in the browser window, you need to change the file type from "dll" to "OCX" (or "all"))</p></li>
  </ol>
  
  <p>Daniel Alexander Karr (refer post further below) has kindly shared a script he wrote to do steps 1 and 2 automatically (note that needs to be run as an Administrator).</p>
  
  <p>Thanks Daniel and wmelonman for your help in understanding the problem and finding a solution.</p>
  
  <p><strong>Original Post</strong></p>
  
  <p>Similarly to what is described in this 3 year old post 
  <a href="https://stackoverflow.com/questions/11971358/excel-vba-automation-errors-due-to-office-service-pack-3-0-caused-by-forms">(VBA Automation Errors due to Office Service Pack 3.0 caused by Forms)</a>, a perfectly working workbook of mine stopped working from one day to the next...</p>
  
  <p>In the list of updates carried out last night the following ones are Office Updates: </p>
  
  <ul>
  <li>KB3114563 (Definition Update for Microsoft Office 2010 32-Bit Edition)  </li>
  <li>KB2881029 (Security Update for Microsoft Office 2010 32-Bit Edition)  </li>
  <li>KB3114555 (Update for Microsoft Office 2010 32-Bit Edition)  </li>
  <li>KB3114553 (Security Update for Microsoft Office 2010 32-Bit Edition)  </li>
  <li>KB3114564 (Security Update for Microsoft Excel 2010 32-Bit Edition)  </li>
  </ul>
  
  <p>There were other updates, but general Microsoft Windows updates, not specific to Office, and they hopefully are not relevant here.</p>
  
  <p>My understanding is that the "Automation error" is due to the project not compiling because of the presence of 2 "additional" ActiveX controls on one of my forms that I have referenced from Microsoft Windows Common Controls 6.0 (Service Pack 6), i.e., <code>MSCOMCTL.OCX</code> which lives in <code>C:\Windows\SysWOW64\</code></p>
  
  <p>Unfortunately un-registering and re-registering <code>MSCOMCTL.OCX</code> <a href="https://stackoverflow.com/questions/11971358/">as explained in the aforementioned post</a> didn't solve the problem.</p>
  
  <p>I also tried deleting all <code>*.exd</code>, but there weren't any on my <code>C:</code> drive.</p>
  
  <p>Additional info that may be relevant:  </p>
  
  <ul>
  <li>The <code>MSCOMCTL.OCX</code> file version is <code>6.1.98.46</code>, created &amp; last modified 2015-12-09 but accessed at 3.33am yesterday (2016-01-15), i.e. about the same time the updates occurred (3:14am for the latest one).  </li>
  <li>Once passed the initial "automation error" message, I would get an additional message, "Compile error: Object library feature not supported", highlighting lines of codes associated with the additional controls.  </li>
  <li>I've verified these were "causing" the problem by creating a blank form an trying to add one on. I got the error message "Could not complete the operation due to error 800a0011".  </li>
  <li>These additional controls are Microsoft TreeView Control 6.0 (SP6) and Microsoft ImageList Control 6 (SP6).  </li>
  <li>I could add the Microsoft TreeView Control, Version 5.0 (SP2) and Microsoft ImageList Control, Version 5.0 (SP2) without raising the error (I didn't try making them work though).  </li>
  </ul>
  
  <p>Does anyone know of similar mishap with <code>MSCOMCTL.OCX</code> following yesterday's Microsoft updates? That may confirm it could be the source of my problem.</p>
  
  <p>Does anyone know of a fix?</p>
  
  <p>Does anyone know how to report this to Microsoft (if indeed it is the source of the problem)?</p>
  
  <p>And finally, for those interested, there is a way to avoid Microsoft Updates messing up ActiveX controls...not using them! This is what JPK has done for his <a href="http://www.jkp-ads.com/articles/treeview.asp?AllComments=True" rel="nofollow noreferrer">TreeView</a>.</p>