While you're editing a Microsoft 365 file that's stored on your device's hard disk or a network location, the Microsoft 365 app puts a temporary version of that file in the same folder where the real file is stored. When you close the real file, normally the system deletes the temporary file.
However, sometimes the temporary file isn't removed. Often, this problem happens because of a sudden, unexpected closure of the app. Whatever the reason, if the temporary file lingers after you close the real file, Microsoft 365 considers the real file "locked," and no one else can open it. This problem causes the "File in Use" error message that says the file is locked for editing by someone.
Tip
When the "File in Use" dialog box appears, you can select the Notify button. This action doesn't fix the underlying issue, but it tells the Office app to alert you automatically as soon as the other person closes the file, so you don't have to keep checking manually. For more information, see Unlock a file that has been locked for editing.
The following sections describe how to fix the situation. The person named in the error message should try the following procedures, starting with the one that best matches their situation.
Unlock a file stored on your local hard disk
First, ensure that the file isn't open on your device, hidden from view by another window. Then follow these steps:
- Open the Windows File Explorer app.
- On the File Explorer ribbon, select the View tab.
- In the Show/Hide group, ensure that Hidden items is selected:
- Navigate to the folder where the problematic file is stored.
- In the file list, locate the temporary file. (It has the same name as the real file, plus ~$ at the beginning of the name.)
- Select the temporary file, then press Delete.
The real file should now be unlocked and available to edit.
Unlock a file stored on a network location
- Open the Windows File Explorer app.
- On the File Explorer ribbon, select the View tab.
- At the end of the ribbon, select See more > Options.
- Select the View tab in the Folder Options dialog box.
- Under Advanced settings, clear the option named Hide protected operating system files (Recommended). select Yes in response to the warning, then select OK.
- Navigate to the folder on the network where the problematic file is stored.
- In the file list, locate the temporary file. (It has the same name as the real file, plus ~$ at the beginning of the name.)
- Select the temporary file, then press Delete. The real file is now unlocked.
- To turn the option back on, on the View tab of the ribbon, select See more > Options.
- Select the View tab in the Folder Options dialog box.
- Under Advanced settings, select the option named Hide protected operating system files (Recommended). Select OK.
The real file should now be unlocked and available to edit.
Disable the Preview Pane in File Explorer
The Preview Pane in Windows File Explorer can lock a file when you select it in a folder, even if you didn't open the file in an Office app. This lock happens because the Preview Pane opens the file to generate a preview, which prevents other programs from editing it.
To turn off the Preview Pane:
- Open the Windows File Explorer app.
- Press Alt+P to toggle the Preview Pane off. Or, on the File Explorer ribbon, select the View tab, and then clear the Preview pane option.
- Try opening the file again.
Close orphaned Office processes in Task Manager
Sometimes an Office app stops responding or closes unexpectedly, but a background process continues to run without a visible window. This hidden process can hold a lock on the file.
- Press Ctrl+Shift+Esc to open Task Manager.
- On the Processes tab, look under Background processes for any instances of the Office app (for example, Microsoft Excel, Microsoft Word, or Microsoft Project).
- Select the orphaned process, and then select End task.
- Try opening the file again.
For more information, see Excel not responding, hangs, freezes, or stops working.
Check for antivirus, backup, or indexing software locks
Third-party software such as antivirus scanners, real-time backup agents, or search indexing tools can lock files while scanning or processing them. Windows Search indexing can also temporarily hold files open.
Resolve SharePoint checkout or OneDrive sync conflicts
If the file is stored in SharePoint or synced through OneDrive, the "File in Use" error might come from a file that another user checked out or from a sync conflict.
If the file is checked out in SharePoint
- Go to the SharePoint document library in your browser.
- Select the file, select the ... (ellipsis) menu, and then select Check in.
- If you're not the person who checked out the file, ask a site administrator to go to Library Settings > Manage files which have no checked in version to override the checkout.
If OneDrive shows a sync conflict
- Select the OneDrive icon in the notification area of the taskbar.
- Look for any conflict or error indicators.
- Pause syncing, wait a few seconds, and then resume syncing.
- Try opening the file again.
For more information, see Check out, check in, or discard changes to files in a library.
Restart your computer
If none of the preceding steps resolve the issue, restarting your computer closes all programs and releases all file handles. After restarting, try opening the file again.