DEV Community

The Sharp Ninja
The Sharp Ninja

Posted on

Fixing Office Interop on 64-Bit Windows 10 ()

The Problem

If you are using Office Interop from .net Framework, then you are actually invoking a DCOM server through proxies included in the Office Interop tools. For Microsoft Word, the actual CLASSID to be loaded is {000209FF-0000-0000-C000-000000000046}. It appears that Word gets a different CLASSID for 64-Bit, {00020905-0000-0000-C000-000000000046}. Because of this, attempting to use Word through Office Interop fails with...

Retrieving the COM class factory for component with CLSID {000209FF-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).

The Solution

Uninstalling the 64-bit version of Office, and installing the 32-Bit version should fix our issue.

Step 1: Uninstall Office

I'll cut straight to the chase. You will need the Office uninstall support tool.

Download Office uninstall support tool

Expand Option 2 and click Download.

Download Uninstall Tool

Answer the questions in the uninstall tool and select the installation of Office you wish to remove. Make sure you have ended all Office applications including OneNote and Teams before continuing. The install will take a few minutes depending on the speed of your storage system.

NOTE: The Uninstall requires a Reboot

Step 2: Dowload Microsoft 365 Offline Installer (32-Bit)

Next, visit Use the Office offline installer. Select your plan. In my case it is Office for Business.

Download and install the Office Deployment Tool

  1. Create a folder on your hard drive and name it ODT. For this example, we'll create it on the c:\ drive, like so: c:\ODT.
  2. Download the OfficeDeployment Tool from the Microsoft Download Center. Select Save As and save it to your downloads folder.
  3. In your downloads folder, double-click the Office Deployment Tool exe file to install it.
  4. If you see the User Account Control prompt that says, Do you want to allow this app to make changes to your device?, click Yes.
  5. Accept the Microsoft Software License Terms, and then click Continue.
  6. In the Browse for Folder dialog, select the ODT folder you created in earlier, and then click OK.

Download and install Office

The file downloaded and extracted to C:\ODT includes four XML files with configuration for downloading and installing Office. Pick the one that matches your use case. For me, I need to install the Office2021Enterprise version in 32-bits. I modify the XML file to match this:

<Configuration>

  <Add OfficeClientEdition="32" Channel="PerpetualVL2021">
    <Product ID="ProPlus2021Volume">
      <Language ID="en-us" />
      <ExcludeApp ID="Lync" />
    </Product>
    <Product ID="VisioPro2021Volume">
      <Language ID="en-us" />
    </Product>
    <Product ID="ProjectPro2021Volume">
      <Language ID="en-us" />
    </Product>
  </Add>

  <Remove All="True" />

  <!--  <RemoveMSI All="True" /> -->

  <Display Level="None" AcceptEULA="TRUE" />

  <Property Name="AUTOACTIVATE" Value="1" />

</Configuration>
Enter fullscreen mode Exit fullscreen mode

Note that I've changed OfficeLientEdition from 64 to 32. I have also incommented some properties to autoregister and accept the EULA as part of the install.

After saving this file, open a Windows PowerShell window and navigate to C:\ODT. Then enter...

.\setup.exe /download configuration-Office2021Enterprise.xml
Enter fullscreen mode Exit fullscreen mode

If you are installing a different version, then replace the name of the XML file.

This will download the installation files. When the prompt returns, enter...

.\setup.exe /configure configuration-Office2021Enterprise.xml
Enter fullscreen mode Exit fullscreen mode

This will install the version you selected. Run the following command in an Administrative Windows PowerShell...

 gwmi Win32_COMSetting | ?{ $_.TypeLibraryId -match "000000000046" } | sort ProgId | Format-Table TypeLibraryId,ProgId
Enter fullscreen mode Exit fullscreen mode

You should see our missing GUID {000209FF-0000-0000-C000-000000000046}.

Discussion (4)

Collapse
andreasjakof profile image
Andreas Jakof

Wouldn‘t it be easier to correct the wrong classid in the registry?

I want to use 64Bit Office for a reason. … it is native to the CPU.

Collapse
sharpninja profile image
The Sharp Ninja Author

Only if you want to breakeverything expecting the new classid. Also, I don't know that the keys are laid out the same between the two versions so I cannot just replicate it either.

Collapse
andreasjakof profile image
Andreas Jakof

Isn‘t it possible to have both CLASSIDs point to the same COM Component?
So instead of replacing, adding the original 32 bit CID to the registry should fix it.
I mean there are already lots of CIDs pointing to WORD.

Thread Thread
sharpninja profile image
The Sharp Ninja Author

That was the second part of my comment. In moving to 64 bit, there's no guarantee that the structures are backwards compatible.