none
Microsoft.Office.Interop.Excel In Windows Server 2012 R2 RRS feed

  • Question

  • I have a very simple program that creates an excel workbook and does some calculation. The executable runs fine when I run it through cmd. However, when the executable is ran through a scheduled task, I get the below error.

    System.Runtime.InteropServices.COMException (0x800A03EC): Microsoft Excel cannot access the file 'C:\ExcelWorkbooks\2018-11-29_4221.xlsx'. There are several possible reasons:

    • The file name or path does not exist.
    • The file is being used by another program.
    • The workbook you are trying to save has the same name as a currently open workbook.
       at Microsoft.Office.Interop.Excel.Workbooks.Open(String Filename, Object UpdateLinks, Object ReadOnly, Object Format, Object Password, Object WriteResPassword, Object IgnoreReadOnlyRecommended, Object Origin, Object Delimiter, Object Editable, Object Notify, Object Converter, Object AddToMru, Object Local, Object CorruptLoad)

    I read many articles which asked me to create directories in C:\Windows\SysWOW64\config\systemprofile\Desktop
    This didn't work for me.

    The puzzling part for me is that this issue is only when I run it through scheduled task program which runs with highest privilege. 

     
    Tuesday, December 11, 2018 8:40 PM