How to Fix Cannot Move Excel Folder Because of a Sharing Violation
Question details
The user is unable to move, rename, or delete a folder containing an Excel (XLSM) file due to a sharing violation error, even when the Excel application appears to be closed.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to move or rename a folder that contains an XLSM file or an empty subfolder, often occurring after a recent Office update.
- Observed behavior
- A sharing violation error is displayed, indicating the folder or file is locked by a background process and preventing the user from completing the file operation.
Ensure that all visible Excel windows and other Microsoft Office applications are completely closed. It is also recommended to save any unsaved work in other applications before attempting to forcefully close background processes.
Use Sysinternals Process Explorer to Unlock the Folder
Identify exactly which background process is holding a handle on your Excel folder or XLSM file and safely terminate it.
Often, a hidden background process keeps a lock (handle) on the folder, preventing Windows from moving it. Sysinternals Process Explorer is an advanced Microsoft utility that allows you to find and terminate these stubborn locks.
Download and run Sysinternals Process Explorer from the official Microsoft documentation website.
Click on the 'Find' menu at the top of Process Explorer and select 'Find Handle or DLL...' (or simply press Ctrl+F).
Type the exact name of the locked Excel folder or the XLSM file into the search box and click 'Search'.
Click on the matching result to highlight it in the main window. In the lower pane, right-click the highlighted handle and select 'Close Handle' to unlock your folder.

Clear Background Processes and Check Antivirus Software
A stuck Excel background task or an active antivirus scan can temporarily lock the folder, triggering the sharing violation.
Roll Back Recent Office Updates
If the sharing violation error started immediately after an Office update, reverting to a previous build may bypass the bug causing the locked handles.
Experience Hassle-Free Spreadsheet Management with WPS Office
If frequent background process locks and sharing violations in Microsoft Office disrupt your workflow, consider switching to WPS Office. It is a highly compatible, lightweight alternative that avoids unnecessary background locking.
- 1. Download and Install: Get the free installer from the official WPS Office website and complete the setup.
- 2. Open WPS Spreadsheets: Launch the application and utilize the tabbed workspace for your spreadsheet tasks.
- 3. Load your Excel Files: Click 'Open' and select your existing .xlsx or .xlsm files to continue working seamlessly.

Frequently Asked Questions
Why does my computer report a 'sharing violation' when Excel is already closed?
Even if the visible Excel window is closed, a background process (like a crashed excel.exe instance, the Windows Explorer preview pane, or an antivirus background scan) might still be holding a 'handle' on the file or folder, signaling to the OS that it is still in use.
Can I move the individual XLSM files instead of the entire folder?
Yes, in many sharing violation scenarios, you can successfully move individual files out of the folder. The system lock is often placed on the folder directory itself or an empty subfolder rather than the specific spreadsheet files.
How do I fix sharing violations caused by the Windows Explorer preview pane?
Open File Explorer, navigate to the 'View' tab at the top, and ensure the 'Preview pane' is toggled off. The preview pane sometimes locks Excel files to generate a thumbnail, which triggers a sharing violation when you try to move or delete the parent folder.




