Word, Excel, PowerPoint Error: file is locked for editing

Whenever you save a Microsoft Office document (Word, Excel or PowerPoint) to your local hard drive or to a fileserver, an associated temporary file is created to the same location as your MS Office document. However, you will not be able to see the associated temporary file from within the Finder because it is a hidden file.

The associated temporary file remains present in the same location as your MS document until you close your document.
The purpose of this associated temporary file is to lockout editing of your MS document to other users while you have it open. The associated temporary file also stores the name of the person who currently has the MS document open, and if another user attempts to open the document, it displays a warning dialogue (see below) to inform them that, “The file is locked for editing”.
microsoft files locked for editing
You can open the document as Read-Only, but you will not be able to edit the document. This is by-design and prevents other users overwriting your work, or even worse causing document corruption.
To clarify, if a user has opened an existing or created an Excel document entitled Example.xlsx, while this document is open there will be an associated temporary file entitled ~$Example.xlsx in the same location as your Excel document. The temporary file is named the same as the Excel document but prefixed with ~$ symbols.
The problem with using an associated temporary file is that if the MS Office application crashes then it is likely that the associated temporary file remains and locks the MS Office document.
Typically this problem is identified when another user attempts to open the MS document, and their MS Office application displays the warning dialogue “The file is locked for editing”, and this is despite anyone else on the same network having the MS document open.

The resolution for this document locking problem would be as follows:

  • Ask the person whose name appears in the warning dialogue, to open the MS document, make a small change to the MS document, File > Save the document, and then close the document. This should then clear the associated temporary file and, therefore, unlock the MS document.
  • Open the MS document as Read-Only, File > Save As, and save the MS document with a different file name.
  • Using the application Terminal (Applications/Utilities), navigate to where the MS document is saved, list all files including hidden files (in Terminal type ls -a), identify the MS documents associated temporary file (remember it will be the same name as your MS document, but prefixed with a ~$), and remove the associated temporary file by using a Terminal remove file command (rm <name of file>). Note: Use the rm command within the Terminal with caution as the removed file is deleted immediately and not moved to Trash.
  • Alternative to using the Terminal app would be to download one of the many free utilities to show/hide hidden files. There are many of these free apps but one I have used is InVisible which when opened is accessible very quickly from your Finders top menubar. It makes toggling between visible/invisible very quick and user friendly.

This MS document locked file issue is a fairly common occurrence so I hope that this article goes some way to explaining how it happens and that the resolutions outlined above help resolve issues that you may experience.
While the author has taken care to provide our readers with accurate information, please use your discretion before acting upon information based on the blog post. Amsys will not compensate you in any way whatsoever if you ever happen to suffer a loss/inconvenience/damage because of/while making use of information in this blog.