How to Repair a Corrupted Macro-Enabled Excel Workbook
Question details
The user needs to recover data from a corrupted macro-enabled workbook that fails to save properly after an update, shutdown, or crash.

- Product
- Microsoft Excel
- Device & OS
- not provided
- Scenario
- Attempting to save or open a macro-enabled workbook based on an older template, resulting in partial repair or save errors.
- Observed behavior
- Excel throws an error message indicating that it can only partially repair or save the file, rendering the macro-enabled workbook unstable or inaccessible.
Create a duplicate backup copy of your damaged workbook before attempting any fixes. Do not overwrite the original file, as repair attempts can sometimes permanently alter the document's structure.
Use the Built-in Open and Repair Tool
Excel includes an automated repair feature designed to recover data and structure from corrupted files during the opening process.
This tool attempts to fix the internal structure of the macro-enabled workbook. If a standard repair fails, it can also attempt to extract just the values and formulas, leaving the corrupted VBA code behind.
Open Microsoft Excel first. Do not double-click the corrupted file directly from your file explorer.
Click on 'File' in the top-left corner, select 'Open', and then click 'Browse' to locate your corrupted .xlsm file.
Click once on the corrupted file to select it. Instead of clicking the 'Open' button directly, click the small arrow next to it and choose 'Open and Repair...' from the drop-down menu.
Click 'Repair' to attempt a full recovery. If Excel informs you that the file cannot be repaired, repeat the process and choose 'Extract Data' to retrieve your values and formulas.

Recover from a Secure Cloud Version
If your file is stored on a cloud service like OneDrive, Dropbox, or Teams, you can restore a previous working version of the workbook.
Share a Sanitized Sample for Advanced Troubleshooting
If you are working with IT support or forum experts, providing a sample of the broken file can help identify structural template issues.
Open and Recover Spreadsheets Easily with WPS Office
If Microsoft Excel is unable to repair your corrupted macro-enabled workbook, you can try opening the file with WPS Office. As a powerful and free Office alternative, WPS Spreadsheets handles complex file structures gracefully and can often open files that other programs consider corrupted.
- 1. Download WPS Office: Visit the official WPS website and download the free WPS Office installer.
- 2. Open the Corrupted File: Launch WPS Spreadsheets, click 'Menu' > 'Open', and select your corrupted .xlsm file.
- 3. Save as a New File: Once the data loads, go to 'Menu' > 'Save As' and save the document as a brand new standard Excel workbook.

Frequently Asked Questions
Why do macro-enabled workbooks (.xlsm) get corrupted easily?
Macro-enabled workbooks are complex files containing both spreadsheet data and VBA code. Unexpected shutdowns, application crashes during a save operation, or conflicts with outdated templates can interrupt the encoding process, leading to a corrupted file structure.
Can I recover the VBA macro code from a corrupted workbook?
If the 'Open and Repair' tool strips out the VBA project to salvage the spreadsheet data, the original macros are lost. The best way to recover VBA code is by restoring a previous version from a cloud backup or extracting it from a copy using specialized third-party recovery scripts.
How can I prevent save errors with older Excel templates?
To prevent recurring save errors, open your older templates, update any deprecated VBA functions, and save them as fresh macro-enabled templates (.xltm) in the latest version of your spreadsheet software. Regularly backing up your files to a cloud service with version history is also highly recommended.




