0

We have a code that exports some data to excel, then uses that excel file to generate a pdf file using the exportAsFixedFormat function. Now it is failing with system exception regularly.

the below is the code

oBook.ExportAsFixedFormat(XlFixedFormatType.xlTypePDF,
                      paramExportFilePath, paramExportQuality,
                      paramIncludeDocProps, paramIgnorePrintAreas,
                      paramFromPage, paramToPage, paramOpenAfterPublish)

        ' Close book
        oBook.Close()
        '
        'Exit Excel
        oExcel.Quit()

below is the exception error we are getting

System.Exception: System.Exception: System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC at Microsoft.Office.Interop.Excel._Workbook.ExportAsFixedFormat(XlFixedFormatType Type, Object Filename, Object Quality, Object IncludeDocProperties, Object IgnorePrintAreas, Object From, Object To, Object OpenAfterPublish, Object FixedFormatExtClassPtr)

Jeremy Thompson
  • 61,933
  • 36
  • 195
  • 321
manu v
  • 1
  • Are you running this on a server? Also, why is this tagged .Net when its not VSTO its VBA? – Jeremy Thompson Feb 28 '22 at 06:44
  • https://stackoverflow.com/questions/7099770/hresult-0x800a03ec-on-worksheet-range – Andrew Mortimer Feb 28 '22 at 08:18
  • `0x800A03EC` is a generic exception which means *what's that?* | *can't find it* | *nope, can't do* etc. Check the path, for example. The other parameters are unknown except `XlFixedFormatType.xlTypePDF`. The last one is missing. -- If you just have `oBook.Close()` and `oExcel.Quit()`, the Excel Process won't quit. – Jimi Feb 28 '22 at 09:19
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 28 '22 at 11:11

0 Answers0