Excel VBA > Run-time error ’70’: Permission Denied

Writing a post about coding issues makes for awkward titles, but it’s likely the term people will search for when there’s a problem. For example, I received the error as it appears in this post’s title while running VBA code for an Excel application: Run-time error ’70’: Permission denied.

Clicking the “Debug” button, highlighted the following code segment:

Running VBScripts in the past was never an issue. However, I don’t use them for every application unless the situation warrants it. In this case, I am using regular expressions to parse entries that would otherwise be awkward and clumsy using traditional coding techniques.

Solving the Problem:

>>>>>>>>>>>>>>> If you’re in a hurry, you can watch our short video (3 minutes)! <<<<<<<<<<<<<<<

In todays world, it is very likely someone else has had a similar experience. In our case, we found a very close to match.

A quick search led me to Excel Forum and this concern: Re: “Permission denied” error on CreateObject(“vbscript.regexp”) with an accompanying link to a Malwarebytes forum that addresses “Application Hardening blocks access to vbscript.dll.” Malwarebytes Premium runs on my system, and I discovered that VBScript is considered an exploit and subsequently blocked.

Run the Malwarebytes application and click on the Settings icon. Then click the Security tab. Scroll down to find “Exploit Protection” and click on the Advanced settings button.

Note the settings of the checkboxes next to “Disable loading of VBScript libraries.” In my case, this box was checked for MS Office:

Uncheck the box and click the Apply button on the lower right corner of the window. Close then restart Excel for the changes to take effect.

Follow the above steps to enable VBScripts to run in Excel and other MS Office applications.

Leave a Reply