I have a custom application which uses Microsoft.Office.Interop.Excel.Application to open and save excel file. I have a batch which fires the app with all the required parameter
I have found a solution here http://justgeeks.blogspot.co.uk/2012/10/troubleshooting-microsoft-excel-cannot.html
the trick is you have to craete this folder:
C:\Windows\SysWOW64\config\systemprofile\Desktop
I must admit I do not quite understand why this folder is required for excel to open files when launched by task scheduler but it works.
Actually I haven't tried the answer by @Maju but this Superuser question has a solution which worked for me: you have to config DCOM. I set the identity to run Excel to the identity which I'm using in the Task Scheduler.
https://superuser.com/questions/579900/why-cant-excel-open-a-file-when-run-from-task-scheduler
I added the following directory c:\windows\syswow64\config\systemprofile\desktop