Excel Initialization Failure on Export

Problem Description

If the Excel initialization fails on the CUSTOMTOOLS Excel Export, the documents included in the Export process may not get exported properly. When this problem occur, an error message similar like the one shown in the following picture appear.

As a text, the error message is similar like the following:

Excel Report
Failed to init Excel. System.InvalidCastException: COM-objektin (tyyppi: Microsoft.Office.Interop.Excel.ApplicationClass) määrittäminen liittymätyyppiin Microsoft.Office.Interop.Excel._Application ei onnistunut. Toiminto epäonnistui, koska liittymän (IID: {000208D5-0000-0000-C000-000000000046}) COM-osan QueryInterface-kutsu epäonnistui seuraavan virheen vuoksi: Virhe tyyppikirjaston/dynaamisesti linkitettävän kirjaston (DLL) luomisessa. (HRESULT-poikkeus: 0x80029C4A (TYPE_E_CANTLOADLIBRARY)).
kohteessa System.StubHelpers.StubHelpers.GetCOMIPFromRCW(Object objSrc, IntPtr pCPCMD, IntPtr& ppTarget, Boolean& pfNeedsRelease)
kohteessa Microsoft.Office.Interop.Excel.ApplicationClass.set_Visible(Boolean RHS)
kohteessa ExportScripts.ParocExcel.initExcel(String workbookToOpen) tiedostossa c:\Users\user123\AppData\Local\CustomTools\2015\List_CT_2015\Add-ins\ListExcel\Excel.cs:rivillä 395

Cause

An error described in this article is caused by an issue in the Windows Registry that have came by installations and uninstallations of the Microsoft Office products.

Solution

To solve this problem, please refer to the following post available in the Microsoft Developer Network (MSDN):

0x80029C4A (TYPE_E_CANTLOADLIBRARY)

The solution is provided in the comment which have the icon associated to the comment.