Excel File Locked by Another User: The Fix
Excel says “locked by” a colleague who doesn't have the file open or left the company long ago? The two most common causes and how to fix them.


The colleague who supposedly has the file open has been on vacation for three days. Excel believes him anyway.
“The file is locked. It is being edited by …” – and then there is the name of a colleague who doesn't have the file open at all. Or, even stranger: a colleague who stopped working at the company long ago.
That is exactly what the technical department of an industrial company reported: On the shared network drive, planning files were repeatedly “locked by” former employees. The question was whether this can be switched off. The answer: You can eliminate the cause. Here are the two most common ones and how to fix them.
Why is an Excel file locked even though nobody has it open?
In most cases, a leftover lock file or a hanging server connection is behind it.
When Excel, Word or PowerPoint open a file on a network drive, they create a small, hidden lock file in the same folder: ~$filename.xlsx. It records who is currently editing the file. On normal closing, it is deleted again.
If Excel crashes, the network connection drops or the laptop is simply closed, the lock file stays behind – and anyone who opens the file afterward gets the message that it is locked.

Why does it show the name of a former employee?
The name does not come from the Windows account but from the Office settings of the computer.
Office stores its own user name. If a PC or a user profile is taken over from a former colleague and not set up anew, their name is often still there. Then every lock file that this computer creates carries the name of the former employee – even though someone else is actually working.
Here is how to check: In Excel, File › Options › General › Personalize your copy of Microsoft Office › User name. If the wrong name is there, correct it – on every affected computer.
Step 1: Find and remove the lock file
- Make sure nobody really has the file open (ask the team briefly).
- Open the file's folder in File Explorer.
- Turn on View › Show › Hidden items.
- Look for the file
~$filename.xlsx– it is small, usually just 1 KB. - Delete it.
After that, the file can be opened normally again.
To find all old lock files in a folder with PowerShell (older than one day):
Get-ChildItem "K:\Abteilung\Planung" -Filter '~$*' -Force -Recurse |
Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-1) } |
Select-Object FullName, LastWriteTimeAdjust the path. Look first, then remove with | Remove-Item -Force.

Step 2: Release the lock on the file server
If no lock file can be found, the server usually still holds the file as “open” – for example because a computer did not end the connection cleanly.
On the file server (or via remote access with administrator rights):
- Computer Management › System Tools › Shared Folders › Open Files.
- Find the affected file – it also shows which user holds it.
- Right-click › Close Open File.

14 days free
IT support that fixes itself.
SuperSupport fixes IT problems right on the device, before they turn into tickets. Try it free for 14 days.
Start free trialWith PowerShell on the server:
Get-SmbOpenFile | Where-Object Path -like '*Planung*' | Select-Object FileId, ClientUserName, Path
Get-SmbOpenFile | Where-Object Path -like '*Planung*' | Close-SmbOpenFile -ForceCaution: If someone is actually working in the file, their unsaved changes are lost.
Step 3: Can you prevent locking by certain people?
Not directly – but you can eliminate the cause. Locking is a protective feature: It prevents two people from overwriting the same file at the same time. You shouldn't turn it off. Instead:
- Correct the Office user names on all computers that were taken over from former colleagues.
- Deactivate the accounts of former employees – then no new locks can arise from there.
- Handover process at departure: When taking over a device, set up the Office profile anew.
- Edit together instead of locking: If files are in SharePoint, Teams or OneDrive, several people can work on them at the same time. Then there is no lock file anymore.
What if the message keeps coming back?
- Antivirus scanner: Some scanners briefly hold files on network drives open. Exceptions only after consulting IT.
- Offline files / synchronization: If the network drive is additionally made available offline or the folder is monitored by a sync client, that can cause locking.
- Excel crashes frequently: Then lock files keep being left behind – the cause lies in the crashes. How to find them is shown in Outlook crashes; the approach applies to all Office programs.
Similar puzzles with “program hangs although it's closed” are described in Program not responding.

How does SuperSupport help with locked files?
On the user's device, the SuperSupport agent can check which Office user name is entered, search the affected folder for leftover lock files and remove them after approval. Closing sessions on the file server is deliberately left to IT. How this looks for internal IT teams and MSPs is explained on the respective pages.
Frequently asked questions
Why is an Excel file locked even though nobody has it open?
Usually an invisible lock file (~$filename.xlsx) was left behind because Excel was not closed cleanly. Or the file is still registered as open on the server because a connection dropped.
Why does the message show the name of a former employee?
The name comes from the Office settings of the computer that opens the file. If a PC or a user profile was taken over from a former colleague, their name is often still there – under File › Options › General › User name.
How do I find the lock file?
In the same folder as the Excel file. It begins with ~$ and is hidden. In File Explorer, it becomes visible under View › Show › Hidden items.
How do I release the lock on the server?
On the file server, find the file under Computer Management › Shared Folders › Open Files and choose “Close Open File”. In PowerShell, it works with Get-SmbOpenFile and Close-SmbOpenFile.
How do I prevent this permanently?
Correct the Office user names on taken-over PCs, deactivate old user accounts and – where possible – edit files together via SharePoint, Teams or OneDrive. There, several people can work at the same time.

14 days free
IT support that fixes itself.
SuperSupport fixes IT problems right on the device, before they turn into tickets. Try it free for 14 days.
Start free trial
Nico Haslberger is Co-Founder & CEO of SuperSupport.ai. With years of experience as an IT technician, he knows the problems in IT support first-hand: from overloaded help desks to recurring tickets that slow teams down. That knowledge is built into every feature of the platform today. He makes sure SuperSupport.ai solves exactly the problems he experienced himself for years.
This article was created with AI assistance and editorially reviewed.
Related Articles

Recover a Deleted File: All the Ways at Work
File deleted, overwritten or unsaved? Recover it via Recycle Bin, OneDrive and SharePoint, version history, AutoRecover, Previous Versions or Time Machine.

Find Your BitLocker Recovery Key: All the Ways
Windows asks for the BitLocker recovery key? Where to find the 48-digit key (Microsoft account, Entra ID, Intune, AD) and why it is requested.

Windows Server Shuts Down Every Hour? Check the License
Server shuts itself down after about an hour – taking VMs and printers with it? Usually the evaluation license has expired. How to spot and fix it.