Yes, you can fix a VBA runtime error 70 ("Permission Denied") in Excel macros—it typically occurs when Excel restricts macro execution due to security settings, file permissions, or macro enabling issues. The solution usually involves adjusting your Excel settings, re-enabling macros, or resolving file access problems. Below is your step-by-step guide to resolving this error with clear, actionable steps.

What You'll Need

  • A working Microsoft Excel application (Excel 2016 or later; older versions may require additional steps).
  • Administrator access if modifying security settings on your PC.
  • A backup of your workbook (recommended before making changes).
  • Microsoft Excel's built-in support for macros (no external tools required).

Step-by-Step

  1. Check if macros are enabled in Excel
    1. Open your Excel workbook.
    2. Click the File tab at the top-left corner.
    3. Go to Options (may appear as Excel Options in some versions).
    4. Select Trust Center on the left sidebar.
    5. Click Trust Center Settings... to open the Trust Center dialog.
    6. Choose Macro Settings from the left sidebar.
    7. Under Macro Security Level, select Enable all macros (Not Recommended) or adjust to Enable all macros with notification (recommended for security).
    8. Click OK twice to save changes.

    Note: If you're unsure, enable macros with a notification first to test. Avoid "Disable all macros with notifications" unless absolutely necessary.

  2. Verify workbook compatibility (if opening from a shared folder)
    1. If the workbook is saved on a network drive, cloud storage (OneDrive/SharePoint), or a shared folder, ensure Excel has full read/write permissions.
    2. On Windows, right-click the folder containing your Excel file, then Properties.
    3. Click the Security tab.
    4. Ensure your user account (not "Everyone") has Full Control or at least Read & Execute permissions.
    5. If permissions are missing, click Edit and add your user account.
    6. Restart Excel after applying changes.
  3. Run Excel with administrator privileges
    1. Close all open Excel instances.
    2. Hold Shift while right-clicking Excel's shortcut or icon.
    3. Select Run as administrator. This bypasses some permission restrictions.
    4. Retry opening your macro-enabled workbook.

    Note: This may require closing other programs that use Excel files to avoid conflicts.

  4. Repair Excel installation (if permissions are system-wide)
    1. Open Excel's File > Account.
    2. Click Manage Excel, then Run Office Repair or Change PC Settings...
    3. Follow prompts to repair Excel components (this may take time).
    4. Restart your computer afterward.

    Warning: This step resets Excel settings. Backup any customizations before proceeding.

  5. Create a new VBA project to isolate the issue
    1. Open Excel and press Alt + F11 to open the VBA editor.
    2. If you're prompted again for macro permissions, click Yes to enable them.
    3. Create a new VBA project by selecting Tools > References... (if prompted about security).
    4. Test if your macro errors occur in the new project. If they don’t, the issue is tied to your original workbook or environment.

    Alternative: Copy-paste your macro code into a new module in the original workbook.

If That Did Not Work

  1. Re-enable macros in the workbook directly (shortcut method)
    1. Open the problematic workbook.
    2. Press Alt + F11 to open the VBA editor.
    3. Go to Tools > Macros....
    4. Select your macro, then click Run.
    5. If prompted for permissions, click Yes.
    6. Close the VBA editor and re-enable macros in Excel's settings (per Step 1 above).

    Warning: This may trigger a one-time security prompt. Use with caution.

  2. Reset Excel settings to default
    1. Close all Excel instances.
    2. Hold Ctrl + Shift while clicking the Excel shortcut to open Admin mode.
    3. Go to File > Options > Advanced.
    4. Scroll to Reset options to restore settings to their default values.
    5. Click Reset All Settings.
    6. Restart Excel and test macros again.

    Note: This resets settings like templates, font preferences, and add-ins.

  3. Contact Microsoft Support
    1. If all else fails, the issue may be tied to a corrupted system file or Excel update. Contact Microsoft Support with details:
      • The exact error (Runtime 70: Permission denied).
      • Steps you’ve already tried.
      • A screenshot of the VBA editor if helpful.
    2. Provide your Excel version (File > Account > About Excel).

Common Mistakes

  • Forgetting to enable macros in Excel settings - Many users disable macros by default for security. Re-enable them first via Options > Trust Center > Macro Settings. - Avoid: "Disable all macros with notifications" unless testing malware scenarios (this is rarely needed for legitimate macros).
  • Skipping admin rights for system-wide fixes - Running Excel with admin privileges (Shift + Right-click > Run as administrator) resolves some permission issues but should be used sparingly. - Warning: Admin access can introduce security risks. Only do this if the error persists after normal steps.
  • Ignoring file location permissions - If the workbook is on a network drive, cloud storage, or shared folder, ensure your account has full access. Right-click the folder > Properties > Security and verify permissions.
  • Assuming the error is code-related - Runtime 70 is always a permission issue, not a logical error in your VBA code. Test if the macro runs elsewhere (e.g., in a new workbook) to isolate the cause.

Tips

  • Test macros in a copy of the workbook - Create a duplicate of your workbook, enable macros there, and test the macro. This avoids potential corruption in the original file.
  • Use the "Enable All Macros" setting temporarily - For testing, enable macros fully (Macro Security Level: Enable All Macros) only for one session. This helps identify if the error is security-related.
  • Check for Excel updates - Ensure Excel is up-to-date (go to File > Account > Check for Updates). Older versions may have stricter macro security by default.
  • Avoid opening multiple instances - Running multiple Excel windows can cause conflicts with macro permissions. Close all instances before retrying.
  • Use Trust Center for advanced users - For deeper troubleshooting, add custom trusts in Excel's Trust Center:
    1. Go to Options > Trust Center > Trust Center Settings > Macro Settings. Click Custom Trust Center Settings....
    2. Uncheck Disable all macros with notifications if it’s enabled. Add your trusted locations (e.g., a personal folder) under Custom Trusted Locations.

Troubleshooting

  1. The macro runs fine but Excel still blocks it - This suggests your Excel version has a stricter security policy. Try:
    1. Switch to a newer Excel version (2016+ has improved macro handling).
    2. Run Excel in "Safe Mode" (disable all add-ins): File > Options > Add-ins > Manage Excel Add-ins > Disable all.
  2. Error persists after all steps - The issue may be tied to:
    • A corrupted Excel file (try opening in another computer).
    • A system-level permission conflict (check Event Viewer for Excel-related errors).
    • A third-party antivirus blocking macros (temporarily disable it to test).
    - Last resort: Reinstall Excel from Microsoft's official site.
  3. Macros work in one workbook but not another - Compare settings between workbooks:
    1. Check if one workbook has "Enable All Macros" enabled while the other has restrictions.
    2. Verify file permissions (are both files stored locally or in a shared folder?).
  4. Excel crashes after enabling macros - This often indicates a corrupted macro or add-in. Try:
    1. Delete all custom-built-in macros (right-click module > Delete).
    2. Enable macros normally (not "All") and test.

Frequently Asked Questions

Why does my Excel VBA macro give "Permission Denied" error?

This error occurs when Excel restricts macro execution due to security settings, missing file permissions, or admin rights issues. The most common causes are: - Macros disabled in Excel's Trust Center. - The workbook or its folder lacks proper read/write permissions. - Excel running without admin privileges or in a restricted mode.

Can I bypass the "Permission Denied" error permanently?

No, but you can work around it by: 1. Enabling all macros temporarily for testing. 2. Running Excel as administrator (short-term fix). 3. Adjusting file/folder permissions. The best long-term solution is to ensure your Excel environment is configured correctly (enable macros properly, use local storage if possible).

How do I fix this error if I’m using Excel Online?

Excel Online has stricter security. Try these steps: - Save the workbook locally first, then open it in Excel Online. - Enable macros in Excel Online (via File > Options > Trust Center > Macro Settings), but use Enable all macros with notification for security. - Upgrade to Excel Desktop for full macro access (Office 365 subscribers can install it).

My macros work in another Excel file but not this one—why?

The issue likely stems from: - Different Trust Center settings (check Options > Trust Center > Macro Settings). - File location (e.g., this workbook is on a shared drive while others are local). - Corruption in this specific workbook (try opening it in a clean Excel session).

What should I do if my antivirus keeps blocking macros?

Antivirus software may falsely flag macros as threats. Try these fixes: - Exclude Excel and VBA-related files/folders from real-time scanning. - Temporarily disable antivirus software to test if it’s blocking macros. - Update your antivirus to the latest version. - Verify your Excel files are not infected (run a manual scan).

Can I fix this error without admin rights?

Yes, try these steps: 1. Enable macros in Excel's settings (Options > Trust Center > Macro Settings). 2. Run Excel in Safe Mode (disable all add-ins). 3. Open the workbook directly from its local folder (avoid network drives). 4. Use Shift + Right-click > Run as administrator (if available in your version).