Excel Error Codes

Fix Excel for Mac Runtime Error 1004 After Saving a Workbook

Adam DavisAdam Davis Nov 20, 2026 869 views

Question details

A user needs to diagnose a VBA runtime error 1004 that occurs after saving a workbook in Excel 2016 for Mac.

Fix Excel for Mac Runtime Error 1004 After Saving a Workbook
Product
Microsoft Excel 2016 for Mac
Device & OS
Mac
Scenario
A macro that worked in Office 2011 is run after its workbook is saved in Excel 2016 for Mac.
Observed behavior
The macro may display runtime error 1004 after the workbook is saved.
Before you start

Note the complete error message and how the workbook was saved, including its location and file extension. Open the workbook in Excel and enable macros only if you trust its source.

Solution 1Recommended

Identify and correct the failing VBA line

Use the VBA debugger to find the cause, then check the workbook format, file paths, and permissions.

1
Locate the error

Run the macro again and record the full error message. If the error dialog offers Debug, click it to highlight the failing line in the Visual Basic Editor.

2
Check the saved format

In Excel, choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm) if the workbook contains VBA. Confirm the saved file has the .xlsm extension.

3
Inspect file paths

In the Visual Basic Editor, inspect the highlighted line and related code for hard-coded paths or filenames. Check whether saving changed the location or name the macro expects; review ThisWorkbook.Path and ThisWorkbook.FullName where relevant.

4
Check access permissions

In Finder, locate the workbook and any files or folders used by the failing line. Choose File > Get Info and check Sharing & Permissions for the required read or write access.

5
Revise incompatible code

Replace Windows-only paths or objects in the affected VBA code with Mac-compatible alternatives, then run the macro again in Excel.

Identify and correct the failing VBA line
Error 1004 has multiple causes: The exact correction depends on the full error message and the highlighted VBA statement. Saving as .xlsm alone may not resolve a path, permission, or compatibility issue.
Free Microsoft Office alternative

Work with Excel Workbooks in WPS Spreadsheets

WPS Office is a free, lightweight Office alternative with a familiar interface and support for common Excel formats, making it easy to move everyday spreadsheet work between applications. It does not fix Excel's runtime error, and VBA macro compatibility may differ.

Open and edit everyday spreadsheets in a familiar interface.Compatible with common Microsoft Excel formats, including .xlsx and .xls.Move routine workbook editing to a lightweight Office suite.Use spreadsheet tools for everyday data analysis and formatting.
microsoft office alternative - wps office

Frequently Asked Questions

How can I find the VBA line causing error 1004?

Run the macro and click Debug in the error dialog if it is available. Excel opens the Visual Basic Editor and highlights the statement that failed.

Why does the macro fail after I save the workbook?

Saving can change the workbook's filename, location, or format. Inspect the failing VBA line for paths and references that may no longer match the saved workbook.

Which format should I use for a workbook containing VBA?

Choose File > Save As and select Excel Macro-Enabled Workbook (.xlsm) to preserve VBA macros. A correct format does not by itself fix incompatible code or permission problems.

Can a macro written for an older version of Office for Mac need changes?

Yes. File access and VBA behavior can differ between Office versions. Review the failing line for outdated assumptions, hard-coded paths, and objects that are not supported on Mac.