Skip to content

Est. 2011ยทMicrosoft Partner 7033487ยทDelivery under 3 minยทSupport 7 days a week

Your vault is empty.

License Error 70

VBA Error 70 Permission Denied: Macros Blocked From Files, Folders and Ports

11 min read Updated October 4, 2026 Outlook & Office Applications

Fix it now

Error 70 is “Permission denied”: Windows refused the macro’s request to touch a file, folder or device. VBA is not blocking you and Office is not blocking you. Something between the macro and the file system is – an attribute, a handle, a permission, or a security product.

  1. Click Debug, read the failing line, and note the exact path it is working with. Print the path first if it is built from variables.
  2. Do the same thing by hand: create a text file in that folder in Explorer, under the same account. If that fails, the macro is innocent and the destination is the problem.
  3. Check the target file’s properties: clear Read-only, and tick Unblock if that checkbox is offered on the General tab.
  4. Close every Office application and look in Task Manager for a leftover host process still holding the file open. Failed automation runs leave these behind constantly.
  5. If the write goes to Documents, Pictures, Videos, Music or Favorites, check controlled folder access: open Windows Security, Virus & threat protection, then under Ransomware protection choose Manage ransomware protection.
  6. Retry against a plain local working folder. Success there proves the destination is at fault rather than the code.

Read the security product’s own log or protection history before you exclude anything. Guessing is how people end up with exclusions on folders that were never the problem, and never remove them again.

If the macro writes its file twice in a row from a cold start, you are done. The next section explains the four gates a file operation has to pass and how to tell which one refused you.

Why it happens

VBA file operations are thin wrappers over ordinary Windows file calls. Opening a file for output, deleting one, or saving a workbook goes through the same path as any other application’s request and meets the same gates: the file’s own attributes, the permissions on the folder, any handle another process is holding, and any filter driver installed above the file system. Error 70 is what comes back when one of those says no, and the published message – “Permission denied” – is deliberately unspecific about which.

The neighbours narrow it down, and each has a published message worth knowing. 75 is “Path/File access error”. 76 is “Path not found”. 52 is “Bad file name or number”, which is about the handle or the name you passed rather than about rights. 55 is “File already open”, which on a second run almost always means the first run never closed what it opened. 57 is “Device I/O error”, which on a network path usually means the connection went away mid-operation.

The gate people miss is controlled folder access. Windows protects a specific set of folders by default – Documents, Pictures, Videos, Music and Favorites, for both the user profile and the Public profile – and an application that has not been allowed through cannot write into them however good its permissions are. Note what is not on that list: the Desktop. A macro that writes to the Desktop and fails is failing for some other reason, and time spent on ransomware protection there is time wasted.

The file is read-only, or was opened read-only

You have this one if Reads work and writes do not, and opening the same file by hand shows read-only in the title bar.

  1. Clear the attribute in Explorer under Properties, or reset the file’s attributes from code before writing.
  2. If the file came from mail, a download or another machine, tick Unblock on the General tab. Office opens files carrying the Mark of the Web in Protected View, which is read-only by design.
  3. Check the file is not stored somewhere read-only for the running account, such as a program folder. Templates you distribute belong in a per-user location.

Another handle is holding the file

You have this one if The error names a file you can see, and closing everything and retrying makes it work.

  1. Close all Office applications and check Task Manager for a host process that did not exit.
  2. Pair every open with a close, and put the close in an error handler so a failure does not leave the number open. Error 55 on the second run is exactly this.
  3. Use FreeFile to obtain a file number rather than hard-coding one, so two routines cannot collide.
  4. On a share, look at the open files list on the server to see who else has it.

A workbook left open by a crashed automation run is invisible in the interface and very much open to Windows. Ending the stray host process releases it.

Permissions on the destination folder

You have this one if The same macro works for you and fails for other people, or fails only against one folder.

  1. Test by hand as the affected user: create and delete a file in the destination through Explorer.
  2. Check effective permissions for that account, remembering that on a share the result is the narrower of the share permission and the file system permission.
  3. Grant the group that runs the macro modify rights on that folder rather than on the whole share, and check the parent if the macro creates the folder itself.

Controlled folder access is blocking the write

You have this one if The destination is Documents, Pictures, Videos, Music or Favorites, and a notification says unauthorised changes were blocked.

  1. Open Windows Security, Virus & threat protection, then Manage ransomware protection under Ransomware protection.
  2. Check Protection history for the block, which is the confirmation rather than the guess.
  3. Allow the specific application through rather than unprotecting the folder.
  4. Where the macro can write somewhere else, do that instead – a working folder outside the protected set removes the question entirely.

Real-time scanning or a sync client is in the way

You have this one if Intermittent, worse inside a loop, and it clears when you step through the code slowly.

  1. Read the security product’s log or quarantine history for a block at the moment of the failure.
  2. Add a narrow exclusion for the specific working folder, never for a whole drive or a user profile.
  3. Where the pattern is a write followed immediately by a rename or delete, a short retry with a brief pause is often enough and costs no security.
  4. For a synchronised folder, have the macro write to a plain local folder and move the finished file in as a final step.

An exclusion is a real reduction in protection. Scope it to one folder, review it, and never exclude a folder that receives files from outside the organisation.

Full reference

Which one is yours

What happens Where to look
Fails every time, on every machine, at the same path Folder permissions or a read-only attribute
Fails intermittently, more often inside a loop Scanning or sync software holding a handle
Fails only for some users File system or share permissions on the destination
Fails only on mail attachments or downloads The file carries the Mark of the Web and opens read-only
Fails when writing to Documents, Pictures, Videos, Music or Favorites Controlled folder access
Fails part way through, on a network path The connection dropped, which surfaces as error 57

The numbers and what each rules in

Error Published message
70 Permission denied
75 Path/File access error
76 Path not found
52 Bad file name or number
55 File already open
57 Device I/O error

What controlled folder access actually protects

  • The user’s Documents, Pictures, Videos, Music and Favorites folders.
  • The Public profile’s Documents, Pictures, Videos and Music folders.
  • The same profile folders for system accounts such as LocalService and NetworkService.
  • Folders you add yourself under protected folders in Windows Security.
  • Not the Desktop, which is why a macro writing there and failing has a different cause.

When a write is refused you get a notification saying unauthorised changes were blocked, naming the application, and an entry appears in Protection history. Those two are how you confirm this cause rather than assume it. The remedy is to allow the specific application through, not to remove protection from the folder.

Closing files properly

Dim fn As Integer
fn = FreeFile

On Error GoTo CleanUp
Open "C:\Work\out.txt" For Output As #fn
Print #fn, "line one"

CleanUp:
If fn <> 0 Then Close #fn
If Err.Number <> 0 Then MsgBox "Write failed: " & Err.Description

FreeFile removes the collision between two routines that both hard-coded number one. The close in the cleanup path is what stops error 55 on the second run, and it has to run whether the write succeeded or failed – which is the whole reason for the error handler.

Things that look like fixes and are not

  • Running Office as administrator. It masks the problem, hides drives mapped by the ordinary session, and creates files the normal user then struggles to manage.
  • Excluding the whole user profile from scanning. That is most of the interesting file system, including where downloads and attachments land.
  • Clearing read-only on a file that is read-only because it is open somewhere else. The attribute is not what is refusing you.
  • Retrying in a tight loop. If the cause is a handle, a retry with a brief pause helps; a tight loop just fails faster.

When a licence is the actual fix

On one machine this costs nothing. Read the security product’s log, allow the application through controlled folder access or add one narrow folder exclusion in Windows Security, and the macro writes normally. It stops being free when the same macro runs on fifty machines and that exclusion has to exist on all of them, survive a rebuild, and be defensible when somebody audits it. That is what a business antivirus licence buys: a console where the exclusion is written once as policy and pushed everywhere, with a record of what was blocked and when. Arco supplies business antivirus licences by seat and term and can say which products expose policy-driven exclusions rather than per-machine ones. If you have one machine and one folder, buy nothing for this.

Every code this article covers

Code What it points at Source
70 Permission denied Microsoft Learn
75 Path/File access error Microsoft Learn
76 Path not found Microsoft Learn
52 Bad file name or number Microsoft Learn
55 File already open Microsoft Learn
57 Device I/O error Microsoft Learn

Confirm the fix worked

  1. Run the macro twice in succession from a cold start of the host application, with no editor open.
  2. Confirm the output file appears at the expected path with the expected timestamp.
  3. Check Task Manager afterwards for any host process left running.
  4. Run it as a normal user on a second machine, not as an administrator on the developer’s.
  5. If controlled folder access was involved, check Protection history and confirm no new block was recorded.

Questions people ask about this

Will running Excel as administrator fix this?

It may mask it, and it is a poor idea. Elevated Office cannot see drives mapped by the normal session, and files it creates get ownership the ordinary user may struggle with later. Fix the permission or the handle instead.

Should I exclude the whole user profile from scanning?

No. That is most of the interesting file system, including where downloads and attachments land. Exclude the one working folder, and only after the product’s own log confirms scanning blocked the write.

Is there a licence that makes this go away?

Not for the fault itself. Where scanning or controlled folder access is the cause, Windows Security is already included with Windows and can be told to allow one application at no cost. A paid business product earns its place when you need central policy and reporting across many machines, not because it makes error 70 rarer.

Why does the code work when I step through it in the editor?

Stepping is slow, so a handle held by a scanner or a sync client has already been released by the time the next line runs. That timing difference points at a handle rather than at a permission, and it is one of the more useful accidental tests you can run.

My macro writes to the Desktop and fails. Is that controlled folder access?

No. The Desktop is not in the default protected list – that is Documents, Pictures, Videos, Music and Favorites, for the user and the Public profile. Look at folder permissions, a read-only attribute, or an open handle instead.

Related error codes

Was this article helpful?

Your feedback helps us improve our documentation.

Related articles

Free Fix Word experienced an error trying to open the file: Recover a Damaged Document License Error Unlicensed Product 0xC004F017 in Word, Excel, Visio and Project: Activation Failed Free Fix Office Crashes 0xc0000374 and 0xc0000409: Heap and Stack Corruption at Runtime Free Fix Outlook Certificate Errors 0x80072F0D and 0x800B0109: Untrusted or Mismatched SSL
โ† Back to Knowledge Base