How to Stop Microsoft Excel From Crashing When closing a file

drom

Active Member
Joined
Mar 20, 2005
Messages
445
Office Version
  1. 2019
  2. 2016
  3. 2013
  4. 2011
  5. 2010
  6. 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
 

Some videos you may like

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

NdNoviceHlp

Well-known Member
Joined
Nov 9, 2002
Messages
2,723
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
 

Watch MrExcel Video

Forum statistics

Threads
1,122,755
Messages
5,597,929
Members
414,193
Latest member
bb60

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
Top