Excel Error Codes

Fix Excel 2010 Run-Time Error 1004 When Saving a Workbook

Rana GarciaRana Garcia Nov 27, 2026 869 views

Question details

Resolve run-time error 1004 when an Excel 2010 VBA macro attempts a second SaveAs operation.

Fix Excel 2010 Run-Time Error 1004 When Saving a Workbook
Product
Microsoft Excel 2010
Device & OS
not provided
Scenario
A VBA macro saves a workbook and then performs another SaveAs operation.
Observed behavior
The second SaveAs operation fails with run-time error 1004, reporting that the target workbook cannot be accessed.
Before you start

Identify the workbook and full destination path used by the second SaveAs statement. Confirm that the destination folder is available and that you have permission to save files there.

Solution 1Recommended

Check the SaveAs destination and file access

Use these checks to rule out an invalid path, a conflicting file, or restricted access.

1
Inspect the target path

Open the VBA editor with Alt+F11 and locate the second SaveAs statement. Check that its destination folder exists and that the filename is valid and has an extension appropriate for the selected file format.

2
Check the destination folder

Open the destination folder in File Explorer and confirm that it is accessible. Try saving a test workbook there from Excel using File > Save As to check your write access.

3
Resolve file conflicts

In File Explorer, look for an existing file with the target name. Close any open copy of that file and check whether another process is using it; if appropriate, try a different filename.

4
Review protection

In Excel, check the Review tab for workbook or worksheet protection and confirm that the destination file is not password-protected or read-only. Remove restrictions only if you are authorized to do so.

Check the SaveAs destination and file access
Free Microsoft Office alternative

Work with Excel Files in WPS Spreadsheet

WPS Office is a free, lightweight alternative with a familiar interface for opening, editing, and saving spreadsheets. Its Excel format support helps with migration, although it does not fix Excel 2010 VBA errors and macro compatibility can vary.

Open and edit spreadsheets in a familiar interfaceCompatible with Microsoft Excel XLS and XLSX formatsSave spreadsheet files using a straightforward Save As workflowFree and lightweight for everyday office work
microsoft office alternative - wps office

Frequently Asked Questions

Why does the second SaveAs fail when the first one works?

The second operation may use a different path, filename, or workbook reference. In the VBA editor, set a breakpoint on the second SaveAs statement and inspect those values before it runs.

How can I check whether Excel can write to the destination folder?

In Excel, use File > Save As and try saving a test workbook to the same folder. If that fails, check whether the folder is available and whether your account has write permission.

Can an existing file cause error 1004?

A file with the same name can cause a conflict, especially if it is open, read-only, or in use by another process. Check the destination in File Explorer and try closing the file or using a different name.

What if there is no password or access restriction?

Inspect the macro's workbook references, path-building logic, and actions between the two saves. Use Alt+F11 to open the VBA editor and F8 to step through the code; rewriting the macro resolved the reported case.

Will WPS Office fix the Excel 2010 VBA error?

No. WPS Office is an alternative for working with Excel-format files, but it does not repair Excel's VBA environment. Macro compatibility can vary, so test any VBA-dependent workbook separately.