How do I use MSProject - Document Export?


I'm trying to use: Microsoft.Office.Interop.MSProject Document Export to export my excel file to PDF as an alternative to Worksheet.ExportAsFixedFormat which causes some HRESULT problems like:

Exception from HRESULT: 0x800A03EC

I have no idea how to use MSProject, but here's what I've tried:

  1. Added the MSProject Reference to my WPF Project: Microsoft.Office.Interop.MSProject (Version
  2. Replaced my Worksheet.ExportAsFixedFormat code with:

    Microsoft.Office.Interop.MSProject.Application mainMSProjectApplication = new Microsoft.Office.Interop.MSProject.Application();
    mainMSProjectApplication.DocumentExport(path, Microsoft.Office.Interop.MSProject.PjDocExportType.pjPDF, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);

I get an exception on the first line:

Retrieving the COM class factory for component with CLSID {36D27C48-A1E8-11D3-BA55-00C04F72F325} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

  1. Then I tried: Windows Key > "Run": regsvr32 "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.MSProject.dll"

I then get this Error:

The module "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Visual Studio Tools for Office\PIA\Office15\Microsoft.Office.Interop.MSProject.dll" was loaded but the entry-point DllRegisterServer was not found.

Any help would be appreciated

asked on Stack Overflow Jan 14, 2019 by Shiasu-sama

1 Answer


It seems my:

Exception from HRESULT: 0x800A03EC

Was caused by me specifying a path that some Users didn't have permissions to write to.

Changing the path in ExportAsFixedFormat to the "My Documents" directory fixed the problem.

As kennyzx commented:

"This is not the right path to go. MSProject is the library for another Office file type and you cannot use it to automate Excel files"

answered on Stack Overflow Jan 22, 2019 by Shiasu-sama

User contributions licensed under CC BY-SA 3.0