Exception from HRESULT: 0x800A03EC

Asked

Viewed 97 times

1

Error executing the following lines of code:

Result res = new Result();

foreach (Process clsProcess in Process.GetProcesses())
{
    if (clsProcess.ProcessName.Equals("Microsoft Excel (32 bit)")
        || clsProcess.ProcessName.ToUpper().Equals("EXCEL")
        || clsProcess.ProcessName.ToUpper().Equals("EXCEL.EXE"))
    {
        clsProcess.Kill();
        break;
    }
}
res.BytesPDF = null;
res.Message = "";
res.Status = false;
res.OutputPath = "";
try
{
    var tmpFile = @ConfigurationManager.AppSettings["tempExcelLocation"];

    var tmpFileStream = File.OpenWrite(tmpFile);
    tmpFileStream.Write(ExcelContent, 0, ExcelContent.Length);

    tmpFileStream.Close();

    tmpFileStream.Dispose();

    foreach (Process clsProcess in Process.GetProcesses())
    {
        if (clsProcess.ProcessName.Equals("Microsoft Excel (32 bit)")
            || clsProcess.ProcessName.ToUpper().Equals("EXCEL")
            || clsProcess.ProcessName.ToUpper().Equals("EXCEL.EXE"))
        {
            clsProcess.Kill();
            break;
        }
    }

    Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
    Microsoft.Office.Interop.Excel.Workbook doc = excel.Workbooks.Open(tmpFile);

Gives the following error Exception from HRESULT: 0x800A03EC when last line is executed.

The Office I’m using is Office 2019.

can help?

  • see if this link can help you: https://social.msdn.microsoft.com/Forums/office/en-US/6f2884f0-5dd2-471c-874c-a7203862effa/how-to-solve-the-error-quotexception-from-hresult-0x800a03quot?forum=exceldev

  • @Carla is a file xls or xlsx?

  • How many lines are there in the spreadsheet you are trying to open? It’s .xls or .xlsx?

  • xlsx. 356 lines.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.