File "locked for editing by 'another user'" opening or saving file in Terminal Services environment
When trying to open or save an Excel file in a terminal services environment, you may encounter one or more of the following errors:
[Filename] is locked for editing by 'another user'
[Filename] cannot be accessd. The file may be corrupted, located on a server that is not responding, or read-only.
This can also happen when trying to open or save a Microsoft Word document in terminal services.
Running Process Monitor you may find that the the following location is being accessed unsuccessfully - "C:\Documents and Settings\%username%\Local Settings\Temp\1". If you try navigating to this folder manually, you may find that the "\1" subfolder doesn't exist. The Office documents are trying to save/access a temporary file from this location and are unable to do so.
The issue is that Terminal Services is using "temporary folders per session", as detailed here - "Temporary Folders". Basically, Terminal Services by default creates a separate temporary folder for each active session that a user maintains on a remote computer. These temporary folders are created on the remote computer in a Temp folder under the user’s profile folder and are named with the "sessionid". In addition, the environment variables for TEMP and TMP are modified. The problem happens when the environment variables are modified but the actual temporary folder is never created. You can manually create the "C:\Documents and Settings\%username%\Local Settings\Temp\1" location, but after logging off and back on this folder may not exist.
To resolve this problem, run GPEDIT.MSC and navigate to Computer Configuration > Administrative Templates > Terminal Services and set the "Use temporary folders per session" to 'disabled'. This will prevent the environment variables from being modified and Office files should be able to save to the location you specify.