locked
Excel file SaveAs not working for xls type from a c# application which has office 365 installed RRS feed

  • Question

  • Issue:

    File save API of excel interop fails when file format is xls.

    API - this.workBook.SaveAs(fileName, XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue);

    log obtained'

    Exception Occurred Exception Message :  ファイルを保存できませんでした。 Exception Type : System.Runtime.InteropServices.COMException Error Code(HRESULT) : 800A03EC Error Code(HRESULT in int) : -2146827284 Stack Trace :    場所 Microsoft.Office.Interop.Excel._Workbook.SaveAs(Object Filename, Object FileFormat, Object Password, Object WriteResPassword, Object ReadOnlyRecommended, Object CreateBackup, XlSaveAsAccessMode AccessMode, Object ConflictResolution, Object AddToMru, Object TextCodepage, Object TextVisualLayout, Object Local)
      場所 Utilities.ExcelWriting.ExcelWriter.Save(String& fileName)

    PC set up - Win 10 with office 365 Pro Plus ja- jp(64 bit) installed

    Analysis - The same API successfully saves the file in xlsx format.   

     File save path is a one drive mapped path - C:\Users\A10564\OneDrive - Sample\デスクトップ\FileName1.xls  -  file save fails

    C:\Users\A10564\OneDrive - Sample\デスクトップ\FileName1.xlsx - file save success

    Note: Issue is not observed in another win 10 pc with same office set up.

    Kindly let us know your feedback

    Thursday, October 29, 2020 11:13 AM

All replies

  • Excel interop API is kind of broken under Office 365. I would suggest using OpenXML SDK instead, it saves XLSX format without Office installed (no XLS, sorry).
    • Edited by Artem Moroz Thursday, October 29, 2020 1:32 PM
    Thursday, October 29, 2020 1:22 PM
  • Doing a quick google the 800A03EC error code is generally attributed to a file not found issue. So the standard questions come to mind.

    1) Does the file already exist.

    2) Is it a permissions issue.

    3) Does it work if you save to a local file first.

    4) Does it work if you save to a different filename.

    5) Are you deleting and recreating the file such that the OneDrive caching could be getting in the way.

    Posting the actual code may be helpful. Note that the actual file extension shouldn't matter at all so when you say you're "saving as XLS" I assume you mean you're calling the SaveAs with the specified file format set correctly.


    Michael Taylor http://www.michaeltaylorp3.net

    Thursday, October 29, 2020 2:33 PM
  • Please find below inputs

    1. The file is newly created(it does not already exist)

    2. I dont think it is a permission issue since the xlsx file gets saved to same path

    3,4. Need to check this point

    5. No such case is done

    Yes save as API is called with xls format.

    Since the same issue is not present in another PC with same set up. we assume something is blocking the save API for xls type  when called from c# application in the issue reported PC. A per google this is a generic error 800A03EC.

    Friday, October 30, 2020 2:30 AM
  • Is there any dependency with office 365, or could it be related to excel settings in PC since only xls file save has issue
    Friday, October 30, 2020 2:32 AM
  • Hi DeepsP,
    The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.
    For auestions about office 365, it is recommended to ask the question on the Office 365 forum and you can get more professional answer.
    Thank you for your understanding.
    Best Regards,
    Daniel Zhang


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, October 30, 2020 5:36 AM