Microsoft Excel cannot access the file -PS Script

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

Sukhija Vikas


2 thoughts on “Microsoft Excel cannot access the file -PS Script

  1. Thank you for your post, I upgraded a Domino server from 2008r2 to 2012 and some lotusscript agents were failing with the same error messages.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s