Excel.Tips.Net ExcelTips (Menu Interface)

Recovering Macros from Corrupted Workbooks

Please Note: This article is written for users of the following Microsoft Excel versions: 97, 2000, 2002, and 2003. If you are using a later version (Excel 2007 or later), this tip may not work for you. For a version of this tip written specifically for later versions of Excel, click here: Recovering Macros from Corrupted Workbooks.

Devarajan ran into a situation where a workbook became corrupted, but he wanted to recover the macro module that was associated with the workbook. (The macros represented quite a bit of development time.) Devarajan wondered how the module could be recovered.

The answer depends, in large part, on how corrupted the workbook really is and where the corruption is located within the workbook. Much has been written about how to recover corrupted workbooks; the following resources will be of interest in this regard:

http://support.microsoft.com/kb/142117 (for Excel 97)
http://support.microsoft.com/kb/179871 (for Excel 2000)
http://support.microsoft.com/kb/820741 (for Excel 2002 and 2003)

Most of these pages refer specifically to recovering data, not to recovering the macros in a module associated with a workbook. (It is interesting that the Microsoft Knowledge Base doesn't have any articles on recovering data from a corrupted Excel 2007 workbook. Perhaps one will come, with time.) One thing that you might try in order to get your macros is the following:

  1. Open Excel, but not the problem workbook.
  2. Set the calculation mode to manual (Tools | Options | Calculation tab | Manual).
  3. Set the security setting to High (Tools | Macro | Security | High).
  4. Open the troublesome workbook. If it opens successfully, you should see a notice that the macros were disabled. (If the workbook doesn't open, then you might as well shut Excel down; this series of steps won't work.)
  5. Press Alt+F11 to display the VBA Editor.
  6. In the Project Explorer, locate the module you want to save.
  7. Right-click the module name and choose Export File.
  8. Provide a name and location of where to save the module.
  9. Close the VBA Editor and get out of Excel.
  10. With the module saved in its own file, you can now import it into another workbook, as desired.

Another way to attempt recovery is to use OpenOffice, a free alternative to Microsoft Office. The spreadsheet program in OpenOffice will open Excel files, and it isn't as sensitive to some corruption issues.

If this still doesn't work, try using a low-level file manipulation tool that allow you to read files sector by sector from a disk, and then allow you to see the information in each sector. With most types of files this won't be very helpful. In fact, it wouldn't help you recover any data from an Excel workbook. Recovering macros is a different story, however. They are stored in the workbook in plain ASCII text, so you should be able to recognize the macro code and then copy it from the disk tool.

ExcelTips is your source for cost-effective Microsoft Excel training. This tip (2399) applies to Microsoft Excel 97, 2000, 2002, and 2003. You can find a version of this tip for the ribbon interface of Excel (Excel 2007 and later) here: Recovering Macros from Corrupted Workbooks.

Related Tips:

Solve Real Business Problems Master business modeling and analysis techniques with Excel and transform data into bottom-line results. This hands-on, scenario-focused guide shows you how to use the latest Excel tools to integrate data from multiple tables. Check out Microsoft Excel 2013 Data Analysis and Business Modeling today!


Leave your own comment:

  Notify me about new comments ONLY FOR THIS TIP
Notify me about new comments ANYWHERE ON THIS SITE
Hide my email address
*What is 5+3 (To prevent automated submissions and spam.)
           Commenting Terms

Comments for this tip:

Udai Kiran    20 Feb 2015, 03:41
Marvelous !!!

I do really want to thank you a ton for your help !!

Saved me extending my pain of 4 hours !
Preeti    21 Apr 2014, 05:07
Hello Allen,
I was trying to upload a macro enabled excel file to google drive and it seems the macros get lost in the process. The google spreadsheets don't recognise these macros. Is there anyway I can upload the MS excel file with the macro intact on google drive?

Hernan     12 Jan 2014, 03:07
Thank You Soooo Much, You Are Savior.
- calc to manual and macro security to high
I just deleted the last 5 codes i was working on cause i knew it was something i did there that got my workbook corrupted
my mistake was saving the book then it wouldn't open again.

thanks to you i deleted the last 5 codes and save it and reopen it and now it works fine, thank you again, thank you a 100000 times.
John    13 Sep 2013, 04:25
Allen thank you for this tip - it just saved the day for me. I had a macro library with all my VBA in a lot of modules and thought I had lost it back 4 months. But setting calc to manual and macro security to high I am now looking at them. Now I wonder which one cause the problem but this is a better problem to have!

Our Company

Sharon Parq Associates, Inc.

About Tips.Net

Contact Us


Advertise with Us

Our Privacy Policy

Our Sites


Beauty and Style




DriveTips (Google Drive)

ExcelTips (Excel 97–2003)

ExcelTips (Excel 2007–2016)



Home Improvement

Money and Finances


Pests and Bugs

Pets and Animals

WindowsTips (Microsoft Windows)

WordTips (Word 97–2003)

WordTips (Word 2007–2016)

Our Products

Helpful E-books

Newsletter Archives


Excel Products

Word Products

Our Authors

Author Index

Write for Tips.Net

Copyright © 2016 Sharon Parq Associates, Inc.