Corrupted Microsoft Excel Macro-Enabled Workbook xlsm file
57 次查看(过去 30 天)
显示 更早的评论
Hello
I have a corrupted Microsoft Excel Macro-Enabled Workbook xlsm file. Does anyone know how i can restore or recover it please?
1 个评论
Walter Roberson
2015-9-20
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.
采纳的回答
Thomas Koelen
2015-5-11
编辑:Thomas Koelen
2015-5-11
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)
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 个评论
Mohamed Sobih
2016-7-16
Hi Thomas, You saved me from very long coding hours. Actually I created my account here just to thank you :) I'm very grateful, Thanks a million :)
Marc
2020-2-26
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.
更多回答(2 个)
Project Coordinator
2019-4-22
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](https://www.mathworks.com/matlabcentral/answers/uploaded_files/215250/Capture.jpeg)
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"
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Import from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!