How to Fix VBA FileSystemObject Error 70: Permission Denied in Excel
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.

- 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.
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.
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.
Review your VBA code to identify the exact file path that the FileSystemObject is trying to access, copy, or overwrite.
Ensure the target file is not open in Excel, Word, or any other program. If you find it open, close the file completely.
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'.
Return to your VBA editor and run the macro again to verify if the Permission Denied error has been successfully resolved.

Verify Folder Write Permissions and File Properties
Error 70 will consistently trigger if your VBA script attempts to save or move a file into a Read-Only directory, or modify a Read-Only file.
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.

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.




