1
votes

When using an old piece of Delphi code which outputs some text into Excel or Word, I encountered the error "Interface not supported" on one machine. How can I fix this?

2

2 Answers

10
votes

The problem was that the previous version of Excel was uninstalled incorrectly on the machine. To fix it, I used the following instructions from Microsoft:

  1. Open the regedit editor.
  2. Open HKEY_CLASSES_ROOT >> TypeLib >> {00020813-0000-0000-C000-000000000046}

(The Excel PIA key is {00020813-0000-0000-C000-000000000046}) 3. Delete the last version folder (Excel 2013 is 1.8, Excel 2016 is 1.9)

A similar fix can be applied to other Office products:

Excel HKEY_CLASSES_ROOT\TypeLib{00020813-0000-0000-C000-000000000046}\

  • 1.7 is for Office 2010
  • 1.8 is for Office 2013
  • 1.9 is for Office 2016

Word HKEY_CLASSES_ROOT\TypeLib{00020905-0000-0000-C000-000000000046}\

  • 8.5 is for Office 2010
  • 8.6 is for Office 2013
  • 8.7 is for Office 2016

PowerPoint HKEY_CLASSES_ROOT\TypeLib{91493440-5A91-11CF-8700-00AA0060263B}\

  • 2.a is for Office 2010
  • 2.b is for Office 2013
  • 2.c is for Office 2016

Outlook HKEY_CLASSES_ROOT\TypeLib{00062FFF-0000-0000-C000-000000000046}\

  • 9.4 is for Office 2010
  • 9.5 is for Office 2013
  • 9.6 is for Office 2016

Here's a sample regedit file to fix the Registry for Office 2016:

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9]
"PrimaryInteropAssemblyName"="Microsoft.Office.Interop.Excel, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
@="Microsoft Graph 16.0 Object Library"

[HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0]

[HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\0\win64]
@="C:\\Program Files\\Microsoft Office\\Office16\\EXCEL.EXE"

[HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\FLAGS]
@="0"

[HKEY_CLASSES_ROOT\TypeLib\{00020813-0000-0000-C000-000000000046}\1.9\HELPDIR]
@="C:\\Program Files\\Microsoft Office\\Office16\\"

[HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7]
"PrimaryInteropAssemblyName"="Microsoft.Office.Interop.Word, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
@="Microsoft Graph 16.0 Object Library"

[HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7\0]

[HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7\0\win64]
@="C:\\Program Files\\Microsoft Office\\Office16\\MSWORD.OLB"

[HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7\FLAGS]
@="0"

[HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046}\8.7\HELPDIR]
@="C:\\Program Files\\Microsoft Office\\Office16\\"
1
votes

We had this same issue and found that: The above solution only works if office is physically installed, if you use O365 and it's click to run apps the above solution will not work. You will need to install the apps physically and not run them as click to run.