Excel lost code modules

jasonb75

Well-known Member
Joined
Dec 30, 2008
Messages
15,507
Office Version
  1. 365
Platform
  1. Windows
Hi all

I just had a system crash that appears to have caused corruption to one of my xlsm files.

When I try to open the file, I get the message

Microsoft Visual Basic

Error occurred during load


I'm then asked if I want to try and repair unreadable content

After hitting ok it tries to load again, then repeats the original message. Following the 3rd attempt I'm then presented with

Excel was able to open the file by repairing or removing the unreadable content.

Removed Part: /xl/vbaProject.bin part. (Visual Basic for Applications (VBA))

Now when I open the VBA editor everything from the workbook has gone, not just one module. Is there any way of recovering this, or am I destined to hours of rewriting the code and userforms that are missing?

I've tried various suggestions from information found through searching this, and other forums, but nothing works so far.

Any ideas?

Thanks in advance.
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
It wasn't accidentally saved as an xlsx was it? That will remove all code. Or was it a crash on re-opening the file?

Denis
 
Upvote 0
Hi Denis, thanks for looking into this.

The file has always been xlsm, it was saved in that format when the file was first created, and since then has always been saved with ctrl + s to save over the existing file.

What actually happened I think was a strain on system resources, I had an out of memory warning following a manual copy / paste special / transpose (100 x 4 array) so i wouldn't think this was what caused it.

This was promptly followed by "excel has encountered a problem and needs to close" for which I left the "recover my work" box checked (maybe that was a bad idea).

This initail recovery failed, with the messages in my original post, and susequent attempts have produced the same.

One thing I did notice is that unlike with previous application failures, I didn't have the option to select from my original file or the recovery backup copy.

Hope that all makes sense

Jason
 
Upvote 0
This info came from the system log, and seems to be related to the problem, not sure if it will mean anything to you.

Event Type: Error
Event Source: Microsoft Office 12 Sessions
Event Category: None
Event ID: 7001
Date: 30/03/2009
Time: 20:21:36
User: N/A
Computer: JASON
Description:
ID: 1, Application Name: Microsoft Office Excel, Application Version: 12.0.6331.5000, Microsoft Office Version: 12.0.6215.1000. This session lasted 15826 seconds with 9960 seconds of active time. This session ended with a crash.


Event Type: Error
Event Source: Microsoft Office 12
Event Category: None
Event ID: 1000
Date: 30/03/2009
Time: 20:21:38
User: N/A
Computer: JASON
Description:
Faulting application excel.exe, version 12.0.6331.5000, stamp 48fa2869, faulting module vbe6.dll, version 6.5.10.24, stamp 464105f1, debug? 0, fault address 0x000e4662.
 
Upvote 0
Hi Jason,

I haven't lost all the code in an xlsm file before so I am not sure what to recommend.
Do you have a backup of the file? If so, restore it with a different name and try copying the code across to the current file.

I ran a search and all of the other errors out there relate to problems with loading Add-ins.

Also, have you tried running the diagnostics? Home > Excel Options > Resources

Denis
 
Upvote 0
Hi Denis,

Thanks for your time on this, unfortunately I don't have another copy of the file, I was in the process of creating the macro's and forms for the sheet, I usually create a duplicate and export all of the code modules to bas files after completion, a stage that I would have probably been at tomorrow.

From what I could see from the system diagnostics (post #5) the error seems to be in vbe6.dll. I don't have any add-ins other than excel jeanie, but this wasn't being used at the time, and I'd had the file open for several hours prior to the problem.

I wasn't aware of the diagnostics resource, but I've just run through that and everything shows "No problems Found", so looks like it just happened to crash at the wrong time and corrupt the file, I had saved just a few seconds before so it's possible that the file could have been corrupted at that point.

Maybe lesson for the day is always save the file in 2 places, I've been trying various ideas from different resources, including free file recovery tools, but they all recover the worksheet only, not the code modules, which is what I've lost, so looks like I'm spending the next day or 2 starting again.

Thanks for your help and time in looking for a solution, but I think without a doubt this file is corrupt beyond recovery.

Jason
 
Upvote 0
Hi Jason,

There's nothing like losing work to really make your day.
Hopefully you can get back to scratch again without too much hassle

Denis
 
Upvote 0

Forum statistics

Threads
1,214,976
Messages
6,122,539
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top