How to Stop Microsoft Excel From Crashing When closing a file

drom

Well-known Member
Joined
Mar 20, 2005
Messages
520
Office Version
  1. 2021
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Hi and Thanks in advance!
I am opening a file and saving every sheet in this opened file as a single sheet in a folder after deleting names, links and so on.
Usually some of my Excel books may have 20/25 sheets.
My macro works fine, i cant put here The code because i am doing somany thing with The sheets, but The macro at least I think so works fine.
No error messages, no bugs, compilación erros...​

Once I finish saving this sheets, I try to close this recently opened file, and some times I have no problems (>85% / 95%) ?
Before closing The file i send a message to let me know every thing goes fine
VBA Code:
MsgBox "Hi,  100% OK ", vbInformation, "I am happy"
But 5/15% of The time.:
  • When closing The file Excel App goes down and I have to restart Excel.?

Any idea with maeby a few lines I should add Before closing a file like????

VBA Code:
Application.DisplayAlerts = False 
Application.CutCopyMode = False 
'Anything else????? 
WKB.Close False.  'WKB is the workbook I am opening, exist and I am using this variable many ttimes through The file  .

Thanks again
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Are you using copy and paste to transfer sheets? Intermittent and unexplainable errors seem to usually be caused by clipboard crashes. Just a thought. Dave
 
Upvote 0

Forum statistics

Threads
1,212,933
Messages
6,110,752
Members
448,295
Latest member
Uzair Tahir Khan

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