'Problem with ExportAsFixedFormat , Excel proccess not closing

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)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source