Random Excel crashes xlsm - excel

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.

Related

"Loading .NET Framework" message when loading an empty workbook in Excel

When opening a particular Excel file, it takes 4 minutes for the message Loading .NET Framework... to clear up. Once it opens, it works fast, as expected. The only suggestion I found was to launch Excel in safe mode. It has the same behavior. I deleted all worksheets, connections to exterior databases, Power Query, VBA, names, and I saved it as XLSX. Still the same behavior.
If I close the spreadsheet (but not Excel) and open it again, it opens fast.
What's even more puzzling is that on some colleagues' machines, it has the same behavior as on mine, and on others, the message Loading .NET Framework... doesn't appear at all (or it is too fast to notice).
Do you have any idea how to get rid of that message short of reinstalling Excel?
Thank you.
I got the answer to my question from here:
https://techcommunity.microsoft.com/t5/excel/loading-net-framework-soooooo/m-p/2264145/highlight/true#M95862
You can get rid of loading .net framework in Excel 2019 by doing File, Info, Check for Issues/Inspect Document and ticking Custom XML Data (you can tick everything else as well, but it will take a long time). It will tell you that Custom XML Data was found, so press Remove. Then close and save.
Next time you open up, no .net framework, and it's much faster.

Get "Microsoft Excel has stopped working" message

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.

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,

VBA refuses to launch

I have several Excel 2007 VBA solutions which have been running fine for years. In mid-December 2018 I got a new computer and installed Office 2007 and all was fine until about three days ago, when as soon as I tried to run a solution or enter the VBA or macro section under the developer tab, I get a message "Unable to load VBE6EXT.OLB", and then a message saying "Out of memory", but the Excel (non-VBA) part continues to function. I have tried every "solution" I found on the web, including uninstalling and reinstalling Office, checking the register for entries said be necessary (they were there - no problem), copying said file from its location in Program Files (x86) to same location in Program Files, checking that Office executables are all running under Windows 7 compatibility, and maybe more that I can't remember. Has anyone encountered this issue? I can't think of anything else to try!

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.

Resources