logo
search
VBA & Macro Problems

How to Fix 'The Script Ran with Errors' in Excel Office Scripts

Natalie TaylorNatalie Taylor Sep 29, 2026 869 views

Question details

The user needs to resolve an issue where Excel Office Scripts fail to execute, showing error messages or unexpected task pane failures.

How to Fix 'The Script Ran with Errors' in Excel Office Scripts
Product
Microsoft Excel
Device & OS
not provided
Scenario
Running automated Office Scripts in Excel desktop or web environments.
Observed behavior
The script execution fails, displaying an error message like 'The Script Ran with Errors' or 'An unexpected error occurred. Close the task pane to try again.'
Before you start

Check your script code for any obvious syntax errors and ensure you have a stable internet connection, as Office Scripts rely on cloud services to run.

Solution 1Recommended

Clear Office Cache and Restart Excel

Clearing the temporary web extension cache can resolve unexpected task pane errors preventing scripts from running.

Office Scripts use a web-based task pane interface. Corrupted cache files in this environment often lead to unexpected runtime errors.

1
Close the Task Pane

Close the Office Scripts task pane and exit the Excel application completely.

2
Open Run Dialog

Press the Windows Key + R on your keyboard to open the Run dialog box.

3
Navigate to the WEF Folder

Type %LOCALAPPDATA%\Microsoft\Office\16.0\Wef\ into the box and press Enter.

4
Delete Cache Files

Select and delete all the files and folders within this directory, then reopen Excel and test your script.

Clear Office Cache and Restart Excel
Cache Cleared: Deleting these files is safe; Excel will automatically rebuild the cache the next time you open a web add-in or the scripts task pane.
Free Microsoft Office alternative

Try WPS Office for Reliable Macro and Script Execution

If you frequently encounter errors with cloud-based Microsoft Office Scripts, consider switching to WPS Office. It provides a lightweight, highly compatible environment with robust support for both VBA and modern JavaScript Macros—completely free.

  1. 1. Download WPS Office: Download and install the free WPS Office suite from the official website.
  2. 2. Open Your Spreadsheets: Open your existing .xlsx or .xlsm files directly in WPS Spreadsheet.
  3. 3. Use JS Macros or VBA: Navigate to the Tools tab to access reliable, offline JS Macros and VBA for your automation needs.
Free, lightweight, and fast installationExcellent compatibility with Microsoft Excel formats (.xlsx, .xlsm)Built-in offline support for VBA and JS Macros for secure automationFamiliar user interface ensuring seamless migration
microsoft office alternative - wps office

Frequently Asked Questions

Why do Office Scripts run differently in Excel web and desktop?

Office Scripts may behave differently because the browser and desktop environments handle dependencies, compile times, and caching in unique ways. A script that fails on the desktop might run smoothly in the browser, and vice versa.

What is the Wef folder in Microsoft Office?

The Wef (Web Extension Framework) folder located at %LOCALAPPDATA%\Microsoft\Office\16.0\Wef\ stores temporary cache files for Office web add-ins and cloud-based features like Office Scripts. Clearing it often fixes task pane load errors.

Can I check specific logs for Office Script errors?

Yes. If your scripts are integrated with Power Automate (Standard workflows in Azure Logic Apps), you can check the workflow run logs to find specific compilation or runtime errors affecting your scripts.

Are COM add-ins known to conflict with Office Scripts?

Yes, certain legacy COM add-ins can conflict with modern web-based task panes in Excel, preventing Office Scripts from rendering or executing properly.