Excel Crashes When Saving Programmatically

neodjandre

Well-known Member
Joined
Nov 29, 2006
Messages
950
Office Version
  1. 2019
Platform
  1. Windows
Hello,

I have a complex macro which transfers some worksheets from a workbook to another.

This works fine. Then my macro presents a msgbox to the user saying that "your file will now be saved".

After the user clicks OK - the following code is fired:

Code:
wb_new.Close SaveChanges:=True

With Application
.Calculation = calcst
.EnableEvents = True
.ScreenUpdating = True
.StatusBar = False
.DisplayAlerts = True
End With

Now for some reason on some machines Excel crashes when attempting to save the file.

This happens irrespective of the file sizes and the contents of the files. It just crashes saying Excel encountered an error and needs to be closed.

I am scratching my head to know why on most machines it works OK and for some others it crashes...

any ideas?

thanks
Andy
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
There's nothing about your code that is a problem per se. Hard to say - maybe excel is calculating before saving/closing and running into problem during the calculation.
 
Upvote 0
If the crashing machines are Macs, its because 2004 is not very stable when working across workbooks. Try an explicit save before closing.

Code:
wb_New.Save
wb_New.Close
 
Upvote 0
Hello guys,

The crashing machines are Windows XP, Vista ... I think it might be a memory overflow issue... is there a way to check this or put some code in to free up memory somehow??
 
Upvote 0
You can open up the task window and watch memory use there. VBA provides no memory management as such.
 
Upvote 0

Forum statistics

Threads
1,215,523
Messages
6,125,321
Members
449,218
Latest member
Excel Master

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