Microsoft.Office.Interop.Excel: Cannot Access Excel Workbook When Running Application Through Scheduled Task RRS feed

  • Question

  • I have a console app that uses interop to create an Excel Workbook based on data in a 2D array.  The app then sends an email with the workbook as an attachment.  The app works perfectly when I run it manually, but when I run it through a scheduled task (which I need to do; the email needs to be sent every 10 minutes), I get the error:

    Microsoft Office Excel cannot open or save any more documents because there is not enough available memory or disk space.

    • To make more memory available, close workbooks or programs you no longer need.

    • To free disk space, delete files you no longer need from the disk you are saving to.

    I researched this error online, and found that in asp.net this can be worked around by using a template.  When I try using a template I get the error:

    Microsoft Office Excel cannot access the file 'Path\Filename.xls'. 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.

    I've tried everything I can think of, including giving full control to the everyone group on the template to rule out it being a permissions issue.  No matter what I try, it runs perfectly when I execute it myself but gives one of the above errors when running as a scheduled task.

    Thanks in advace if anyone has experienced something like this and/or has any suggestions.



    • Moved by Zhi-Xin Ye Monday, December 1, 2008 8:11 AM off topic (Movido de Common Language Runtime a Off-Topic Posts (Do Not Post Here))
    Monday, November 24, 2008 8:36 PM


All replies