logo
search
Excel Error Codes

How to Fix VBA FileSystemObject Error 70: Permission Denied in Excel

Chanuka GeekiyanageChanuka Geekiyanage Sep 25, 2026 869 views

Question details

The user encounters a Run-time error 70: Permission denied when executing a VBA macro that uses FileSystemObject to manipulate files or folders.

How to Fix VBA Error 70: Permission Denied in Excel
Product
Excel
Device & OS
not provided
Scenario
Running an automated VBA script containing FileSystemObject commands to read, copy, move, or modify external files and directories.
Observed behavior
The macro execution halts unexpectedly, displaying Run-time error '70': Permission denied, indicating the target file or folder is locked or the user lacks sufficient access rights.
Before you start

Save your current VBA project progress before debugging, and ensure you have administrative or write privileges for the specific folders your script is attempting to access.

Solution 1Recommended

Close Open Files and Check for Background Processes

The most common cause of Error 70 is that the file your script is trying to modify is currently open or locked by Excel or another application.

When FileSystemObject attempts to manipulate a file that is already in use, the operating system strictly blocks the action to prevent data corruption. Resolving this requires closing any active locks on the file.

1
Identify the target file

Review your VBA code to identify the exact file path that the FileSystemObject is trying to access, copy, or overwrite.

2
Close the file in all applications

Ensure the target file is not open in Excel, Word, or any other program. If you find it open, close the file completely.

3
End hidden background processes

If the file appears closed but the error persists, press Ctrl+Shift+Esc to open Windows Task Manager. Look for hidden background instances of Excel that might be holding the file open, right-click, and select 'End Task'.

4
Re-run the macro

Return to your VBA editor and run the macro again to verify if the Permission Denied error has been successfully resolved.

Close Open Files and Check for Background Processes
Network Drive Locks: If the file is located on a shared network drive, another user on your team might have it open. You will need them to close the document before your script can successfully run.
Free Microsoft Office alternative

Experience Seamless Macro Support with WPS Office

If troubleshooting OS-level Excel VBA runtime errors is slowing down your workflow, consider trying WPS Office. It provides an exceptionally smooth experience with robust support for spreadsheet automation, offering a lightweight and free alternative to standard Microsoft Office.

Highly compatible with standard Microsoft Excel formats, including .xls, .xlsx, and macro-enabled .xlsm files.Built-in, comprehensive support for VBA macros, allowing you to run your existing automation scripts effortlessly.Lightweight architecture that runs swiftly on older computers without bogging down system resources.Free to download and use, featuring a familiar interface for a seamless migration experience.
microsoft office alternative - wps office

Frequently Asked Questions

Can antivirus software cause VBA Error 70: Permission Denied?

Yes, aggressive antivirus or built-in ransomware protection software (like Windows Defender Controlled Folder Access) can block VBA scripts from interacting with specific directories. Try temporarily disabling the protection or whitelisting Excel in your security software.

How do I handle FileSystemObject errors in VBA gracefully?

You can implement error-handling statements such as 'On Error Resume Next' or 'On Error GoTo ErrorHandler' immediately before your FileSystemObject commands. This allows the script to intercept the error and display a friendly message box rather than crashing abruptly.

Why does my macro work locally but throw Error 70 on a network drive?

Network drives often enforce strict, centrally managed permission policies. While you may have read access to the shared drive, you might lack the necessary write or modify permissions required by your script. You must contact your network IT administrator to request write access for that specific destination path.