Fix Excel Network File Locks After Save As
Question details
Find out why an old network file remains locked after Save As and how to release the lock before deleting it.

- Product
- Microsoft Excel and Microsoft Word
- Device & OS
- not provided
- Scenario
- A user saves an Office file under a new name and then tries to delete the original network file with VBA or File Explorer.
- Observed behavior
- The original file may remain open or locked, causing a Permission denied error during deletion.
Confirm that the new file opens successfully and identify the exact original network path your code or File Explorer is trying to delete. Check whether other users or programs have the original file open.
Close Office references before deleting the original file
Use this approach when a VBA procedure saves a file under a new name and immediately deletes the original.
After Save As, check the destination path and confirm that the new workbook or document was saved successfully.
In VBA, close the workbook or document object after saving, or use File > Close in Excel or Word. Save any remaining changes before closing.
Set workbook, document, worksheet, and other relevant object variables to Nothing in the VBA procedure. Quit an Office application instance only if your automation created and owns it.
Use VBA Kill on the original path only after the file is closed, or try deleting it in File Explorer. Allow a short delay and use a limited retry if the network lock takes time to clear.

Identify the process holding the network file
Use these checks if the original file remains locked after Office references are closed.
Work with Office files in WPS Office
WPS Office is a free, lightweight alternative with a familiar interface for working with Office files. Its format compatibility helps you move existing documents and spreadsheets into WPS, although it does not fix Microsoft Office network locks.

Frequently Asked Questions
Why does VBA Kill return Permission denied after Save As?
The original file may still be locked by Office, another user, a sync client, antivirus software, or a server process. Close the relevant Office objects and identify any remaining lock before retrying Kill.
Does setting a workbook variable to Nothing close the workbook?
No. Close the workbook with its Close method first, then set the workbook and related object variables to Nothing.
How can I tell whether the network share is involved?
Repeat the Save As and delete steps with a test file on a local drive. If only the network version fails, ask the network administrator to check the share and any open sessions.
Should my VBA code quit Excel after Save As?
Quit Excel only if your automation created and owns that application instance. Otherwise, close the relevant workbook without terminating the user's existing Excel session.




