Corrupted Microsoft Excel Macro-Enabled Workbook xlsm file

61 views (last 30 days)
Hello
I have a corrupted Microsoft Excel Macro-Enabled Workbook xlsm file. Does anyone know how i can restore or recover it please?
  1 Comment
Walter Roberson
Walter Roberson on 20 Sep 2015
This question was posted by a spammer as the lead-in for a spam response. I have not deleted it, however, because Thomas's response is legitimate and helpful.

Sign in to comment.

Accepted Answer

Thomas Koelen
Thomas Koelen on 11 May 2015
Edited: Thomas Koelen on 11 May 2015
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.
  2 Comments
Marc
Marc on 26 Feb 2020
Hi Thomas. Like Mohamed, I created an account just to thank you. I couldn't open an Oracle EBS upload macro file and following your steps saved me a lot of rework. Just wanted to thank you.

Sign in to comment.

More Answers (2)

Manrique Vargas
Manrique Vargas on 24 Nov 2017
Thank you, Thomas, you are a savior.

Project Coordinator
Project Coordinator on 22 Apr 2019
Like Mohammed above I created an account here just to say thanks!
I also wanted to let people know this fix works for MS Excel 2016 as well.
I also was a little desperate after recent Microsoft updates. My .xslm file would NOT open and just kept shutting down.
After applying the fix above I realized that Microsoft in its wisdom has decided to reset all MSOffice programs back to default settings when they did the most recent update "Windows 10, version 1809 amd64 2019-04"
Capture.JPG
What you need to do is check all of the settings as shown above.
Open your file in a Macro disabled environment. Save it
Then start to build up the settings again to where your macros are enabled.
Good luck to anyone who has been struck by this latest Microsoft created "bug"

Categories

Find more on Data Import from MATLAB in Help Center and File Exchange

Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!