I'll start saying I'm relatively new to SSIS development. I have a process that executes a Select and stores the data into an excel (This works like a charm). On the next step, the excel is now converted into a pdf file. But on that execution, the code returns the error 0x800A03EC. This is the line:
excelWorkbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, pdfpath);
Its worth saying that this has been working for years, and only now started failing. Its also worth to say that I encountered some more problems with other Interop functions as the Range.CopyPicture().
This is the whole code.
public void Main()
{
Dts.TaskResult = (int)ScriptResults.Success;
//Totally fine paths
string excelpath = ""
string pdfpath = ""
//No idea why is this here
System.Threading.Thread.Sleep(2000);
Microsoft.Office.Interop.Excel.Application excelApplication;
Microsoft.Office.Interop.Excel.Workbook excelWorkbook;
excelApplication = new Microsoft.Office.Interop.Excel.Application();
excelApplication.ScreenUpdating = false;
excelApplication.DisplayAlerts = false;
excelWorkbook = excelApplication.Workbooks.Open(excelpath);
if (excelWorkbook == null)
{
excelApplication.Quit();
excelApplication = null;
excelWorkbook = null;
}
try
{
excelWorkbook.ExportAsFixedFormat(Microsoft.Office.Interop.Excel.XlFixedFormatType.xlTypePDF, pdfpath);
}
catch (System.Exception ex)
{
Dts.TaskResult = (int)ScriptResults.Failure;
}
finally
{
// Close the workbook, quit the Excel, and clean up regardless of the results...
excelWorkbook.Close();
excelApplication.Quit();
excelApplication = null;
excelWorkbook = null;
}
}
The paths are totally fine, I also checked no excel process was running on the background before the process started. I also tried executing with different users... Nothing seems to work.
Could anyone give a helping hand?
Thank you very much.