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:
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)).
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
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"
User contributions licensed under CC BY-SA 3.0