MATLAB: Corrupted Microsoft Excel Macro-Enabled Workbook xlsm file

excel

Hello
I have a corrupted Microsoft Excel Macro-Enabled Workbook xlsm file. Does anyone know how i can restore or recover it please?

Best Answer

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/820741 (for Excel 2002 and 2003)
for 2010:
Open Excel 2010.
Click on File > Options.
Select Trust Center > Trust center settings.
Select Protected view.
Uncheck all the options under Protected View > OK. Restart Excel 2010 and try to open Excel documents.
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:
Open Excel, but not the problem workbook.
Set the calculation mode to manual (Tools | Options | Calculation tab | Manual).
Set the security setting to High (Tools | Macro | Security | High).
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.)
Press Alt+F11 to display the VBA Editor.
In the Project Explorer, locate the module you want to save.
Right-click the module name and choose Export File.
Provide a name and location of where to save the module.
Close the VBA Editor and get out of Excel.
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.