We help IT Professionals succeed at work.
Get Started

Out of memory/Excel crashes on form loading

Rich5150 asked
Last Modified: 2012-05-05
I have a spreadsheet with one main userform that is shown by clicking a commandbutton in a worksheet.  Occasionally, upon attempting to show the userform, Excel will provide the message indicating that it has encountered an error and needs to close, with no other error messages.  I have also occasionally encountered an out of memory error that shows when the user attempts to close the workbook.

I'm trying to figure out if these two problems are related.  I have some rather long macros, with the largest being about 116Kb, which resides in a module.  The userform I am referring to has a .frx file of about 112Kb.  Are either of these so large as to be causing these errors?  I'm not worried about reducing macro sizes, but it's definitely more difficult to reduce the memory used by the userform.  

The strangest thing is how sporadic this problem is.  Upon encountering the fatal error that closes Excel (which just happens every so often for no apparent reason) , if I reopen, disable macros, rename the file, close and then reopen with macros enabled, it works fine.  What about renaming the file is causing this error to go away?  Thanks for your help!
Watch Question
Social distance; Wear a mask; Get vaccinated
Top Expert 2014
This problem has been solved!
Unlock 1 Answer and 21 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE