Get "Microsoft Excel has stopped working" message - excel

I'm running MS Office 2010 on Windows 7 Professional.
I’ve been experiencing this problem periodically for the last month or so, not all the time, but probably once or twice a week.
I’m working on the VBA portion of a fairly complex workbook. I start the day by making a copy of the previous day’s workbook, and make any subsequent code changes on the copy. When I’m finished I’ll run VBA Code Cleaner, do a Debug, Save then exit Excel. I also save a backup copy. I’ll then reopen & close both of these workbooks a number of times just to satisfy myself that everything is still working.
The next day I’ll wake the computer and try to open these files, and as soon as the VBA code starts to run I’ll get the “Microsoft Excel has stopped working” message. This can happen to either the main file or the backup file, and sometimes both.
If I open the bad file with the shift key down, I can get into the VBE area OK, but when I do a Debug or try to run VBA Code Cleaner I get the same message.
The only way I’ve found to recover from this is to:
Manually export the code
Save the file as an xlsx file, thus expunging all the code.
Save the xlsx file as a new xlsm/xlsb file, and then import the exported code.
I just today found another way to recover is to save the file as “xls”, then re-save as xlsb/xlsm, that somehow seems to “clean” something.
After the recovery everything is fine again, at least for a few days.
What I’ve tried so far:
Searched the internet, including StackOverflow, for possible solution.
Run various virus checkers (MS Essentials, Malwarebytes, SuperAntiSpyware)
Repaired MS Office 2010.
Uninstalled and re-installed MS Office 2010
Removed all add-ins
Uninstalled Dropbox
Started using a new user profile.
I came across several articles that suggested xlsb files were prone to corruption, so I started saving as xlsm files. Everything went well for about a week, and I thought I’d resolved the problem. However, it’s now started happening with the xlsm files too, so I’m back to square one.
I’m running out of ideas - the next thing I might try would be re-installing Windows 7, but I really hope to avoid doing that! I would really appreciate any suggestions. Thanks.

Well, I believe I may have found my problem. I noticed that one of my class objects wasn't always terminating correctly, due to it being referenced in a different class. I fixed that, and now it's been 11 days without any problem (touch wood). So I'm reasonably confident that this was the root cause. But I must admit I'm still not quite sure why this occasionally corrupted the workbook.

Related

Getting System Error &H80070057 (-2147024809)

I've been running a workbook with a few macros in it for a couple of years, and I've suddenly started getting this error thrown at me for some navigational buttons (shapes linked to macros that are simply ThisWorkbook.Sheets("sheet_name").Activate).
Other Macros within the workbook seem to work OK, but I can't get into the VBA editor to see any of the code anymore - I get to the VBA interface, but when I go to open the Module, nothing happens.
And to cap it all off, when I try to save the workbook, I'm just getting an error saying 'Document not saved'.
I had the same issue. I opened the VBA code module and then selected Debug then Compile VBAProject. I then closed the Visual Basic Editor and the error seems to have been resolved. Have only had the issue the once so can't be 100% sure it will work in every instance but worth a go.
Suggest you open a backup copy of this file (if you have one), export the broken module and then in your current file, remove the broken module and import the clean version.
We had the same problem in a file that was drawing data from an external source and saving itself automatically every minute. What worked for us was just replacing the entire file with a backup from 2 days ago.
We also had the "Document Not Saved" error, which was solved by upgrading the file from .xls to .xlsx
Just came across this error - for me it seems to affect any code opening docs via external links. Ran the debug suggested above and fixed issue.

Excel crashing randomly

I generate over 100 reports daily in Excel, all with extensive VBA code. Unfortunately, some files are randomly corrupted for no reason that I can define. Either the file will crash immediately upon open, the user will get the "can't find project or library" error, a bad parameter warning will show, or the workbook will be completely unusable as all VBA functions are frozen. In the windows log I will usually see a faulting module for VBE7.dll. I am running Windows 10 Pro, version 10.0.18362 and Excel 64bit with all updates. I've reinstalled MS Office and Windows with no help. I've tried various other fixes (registry changes) that did not help either. This is a random problem as it doesn't happen to every report but it occurs every day to some of them. All can be repaired by opening in safe mode and recompiling the code but this is not something I can expect users to do nor do they have access to the code (all pw protected). I've dealt with this issue for the last two years and nothing has worked. Microsoft has been utterly unhelpful as well. Any help would be greatly appreciated. Additionally, for any true experts out there who could dig into this and find a solution I am certainly willing to pay for your time and expertise. Thank you.
the error saying "can't find project or library" could be traced using ProcessExplorer
That tool will show you what is going on inside MS Excel at the time of opening the file. With luck, you will see what file, dll or complement is not being loaded and throw the error.
Hope it helps,

Random Excel crashes xlsm

In my company I'm using Excel 2013 64bit and many xlsm files with some macros that use basic build in libraries. Occasionally I encounter a random "microsoft excel has stopped working" (- mostly on opening a file but last week it happened while I was just staring at the screen). 95% of the times making a copy of the file, so that excel would not see it as trusted, going to vba editor and compiling vba project manually and saving it would fix the problem, however it recently got simply annoing as frequency of those crashes went from 1/week to several per day. I think I waste like 30 minutes daily just on fixing crashed files. So generally I know what to do when excel crash happens but I would like to know if there's something that can be done to prevent them from happening in the first place.
Also the crashed files work flawlessly on a machine with excel 2010 on it. Saving the file with E2010 also fixes the problem for E2013
64 bit Office has a lot of problems with VB code. These seem to be related to the pcode that get's generated when the code is compiled and so recompiling seems to fix them. There's a registry fix to force recompile, you need to set these two values:
HKEY_CURRENT_USER\Software\Microsoft\VBA\7.0\Common
Type: DWORD
Name: CompileOnDemand
Value: 0
and:
HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Excel\Options\
Type: DWORD
Name: ForceVBALoadFromSource
Value: 1
These two fixed it for me.

Excel crashes when loading file that contains userform

Excel crashes when opening files that contain a userform
This is a known problem with a known solution workaround which is to delete a file called Excel.box from here:
C:\Users\SlowLearner\Application Data\Microsoft\Forms\Excel.box
According to this forum post the purpose of the Excel.box (& Word.box) file is:
Files such as Winword.box and Excel.box are associated with the
Control Toolbox you see when you are designing a UserForm in the
Visual Basic editor. The files contain information about the layout of
the Control Toolbox (additional tab pages, controls that have been
added or removed, custom icons, ...) If a user has never modified the
Control Toolbox in any way, there will probably be no .box file. By
deleting a .box file, you will restore the Control Toolbox to its
default (factory preset) configuration - this is the only way to do
that. Sometimes, the .box file becomes corrupted and must be deleted.
There are no negative side effects to deleting it.
Unfortunately Excel.box returns :(
It would seem that for most users the problem is fixed by deleting the file, sadly not for me.
I'd like to understand what is causing this problem to recur. A few points to note:
this (touch wood) is not impacting MS Word on my PC
I am using Office 2010, 64 bit version on Win10
I have not made any conscious change to form settings
if I delete the file > start Excel > UN-DELETE the file: everything works :-/
some other experiences with this issue here
For the time being I'll just check for and delete the file before launching Excel, but this is hardly an acceptable solution for the long term. Appreciate thoughts for a proper fix... TIA
Additional Information:
I have not fully explored the crash but so far it happens when:
starting the application by opening an xl?.m file with a userform
application does not get past the splash screen
crashes with the application's CRASH screen (... encounted an error...)
starting the application with a blank worksheet then adding a userform
crashes immediately with the applications CRASH screen displayed (see below)
The above crash happened after rebooting my PC, had a chance to explore it some more.
First I opened the file I had been working on (contains userforms):
annoyingly it opened without crashing
I did NOT enter the IDE
I closed the file (Excel closed normally)
Then I created a new worksheet
I opened the VBA IDE
right-click 'add UserForm' - Excel crashed immediately
(I aborted the recovery / search for a solution attempt)
Then I re-opened the file I had been working on
opened the VBA IDE (the project is PW protected)
the very instant that I entered the PW and hit enter Excel crashed
crash was same both times...
Safe Mode:
Crash still happens in safe mode - steps to reproduce:
Run: Excel /safe
Open VBA IDE
r-click add userform
crashes immediately
Creation of the EXCEL.box file
Based on visually observing the folder which had the Excel.box file I did some tests to try and see when it was created. Basically it seems to appear when one of the following happens:
- the UserForm tools box is closed
- the IDE is closed (after showing the userform)
I've also now tried to modify the userform toolbox by removing everything from it. Excel is still crashing after every restart of the application (which is odd as I was not able to crash it like that earlier).
Office Repair - not tested (yet)
Reluctant to try Office Repair as based on the following quote from here (scroll down: pg 1 reply 8 by Steve IT) I'm not expecting it to work :-/ (but will try if no other suggestions surface).
Thanks for the continued suggestions, however I have tried a repair and also removed Visual Studio 2013 and Office altogether (just in case VS was interfering) and reinstalled both, but it still throws the errors reported previously.
Other user profiles
Created a brand new user called 'test'. Test has the exact same problem.
This problem eventually resolved itself, not sure why. I continued to use Excel normally and it continued to crash so I would delete the offending .box file and start over...
As of Nov 2017 Excel no longer crashes with respect to this issue; my best guess is there was an automatic update that resolved the issue.
Looks like this issue still occurs and it is not just limited to Excel but also Powerpoint.
The fix as mentioned above works where you move / delete any files in the below folder location resolves the issue.
C:\Users\%username%\Application Data\Microsoft\Forms
It is highly likely that this error is caused by bad code in a macro or an Add-In that uses forms. The problem is replicating this can be difficult so you have to debug this in some way when it does crash out.
POWERPNT.box
EXCEL.box
are some of the files that get generated, where Excel or Powerpoint crash on the splash screen.
Try adding the command
ThisWorkbook.VBProject.VBComponents("UserForm").Activate
just before your
"UserForm".Show line.

Personal Macro Workbook has gone missing (AGAIN)!

I don´t understand why, but it´s the second or third time I've lost my Personal Workbook with all my macro copies. The only different thing that I've done was editing a macro but, when excel was closing, I haven't saved the changes. Next time I've opened excel, surprise, surprise, no Personal Workbook! Has anyone had the same problem? Does anyone know why it happens? I have already searched in (I believe so) all possible folders where It could be stored.
Thanks!
the file can be found for 2007/2010 users in :
C:\Users\User ID\AppData\Roaming\Microsoft\Excel\XLSTART
or somewhere similar for others.
Hope this helps
The folder where the personal macros are saved can be found by using the command:
?Application.StartupPath (without "" sign) in VBA.
Open VBA (ALT+F11) and enter the command in the field on the bottom.
Hope this helped
Using Microsoft office 365. Lost Excel and Word Macros during last update. Had an Excel File that I had copied to my laptop (Windows 10) which had not been updated. Brought it up on my desktop. Was able to see modules but no content. Was unable to remove modules. Uninstalled Office 365. After reinstall, was able to see and use macros from that file. Word macro not retrieved. Hope it helps someone.
Mine went missing completely and was not in the xlstart folder. I finally discovered it was because I'm on a work server, files are all network storage based, and I had just changed my network password. I think the mis-match caused my links to personal files to be temporarily broken. I logged out completely, and back in, and everything was back where it should be.
In short: I tried turning it off and turning it back on again.
For those using MacOS / OSX (El Capitan) with Excel 2016 I located my copy of Personal Macro Workbook.xlsb, which I had previously unhidden in Excel, then closed, in the following location:
~/Library/Containers/com.microsoft.Excel/Data/Application Support/User/Personal Macro Workbook.xlsb
Please note that I used multiple search functions within OSX which did not return this file in the search results for some reason.

Resources