Sharing a TIP on Scheduling a script that contains excel code.
One of my Script that uses excel was running fine when I was launching it interactively but if scheduled thru
Task scheduler it wasn’t working & threw below errors:
Microsoft Excel cannot access the file
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
On researching there found a simple fix , Just create a directory with name Desktop
C:\Windows\SysWOW64\config\systemprofile\Desktop -(64 Bit OS)
C:\Windows\System32\config\systemprofile\Desktop -(32 bit OS)
After doing this my script started running fine, hope this TIP will assist you if you are in same situation.
Thanks for reading