ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Background Processes in File Save versus File SaveAs (https://www.excelbanter.com/excel-programming/409949-background-processes-file-save-versus-file-saveas.html)

Paige

Background Processes in File Save versus File SaveAs
 
Here's the screnario: Only 1 file is open; it has formulas, but they have
all been calculated. There is no before_save (or before_close) code. When I
do file/save from the menu (and also from VB), Excel does not do a
recalculation; however, when I do file/save as from the menu (and also if I
do it from VB and even if I use Application.Calculation = xlCalculationManual
before the saveas command), it does a recalculation. 3 questions:

1) Why does it act differently between file/save and file save as?
2) Why is my Application.Calculation = xlCalculationManual command being
ignored?
3) How can I force it to NOT recalculate during saveas?

James Snell

Background Processes in File Save versus File SaveAs
 
1) The short answer is that Save and Save As are different code paths. The
same applies in most of the other office applications by the way. Useful to
remember if you have a troublesome document or workbook.

2) It is not being ignored. Many things which are derived from the file
content are discarded to ensure the saved file is clean, the result cache is
one of these items. To save the result cache it must be regenerated.

3) You cannot. But you could move the SaveAs - One option might be to do
your SaveAs at the beginning of your code (or when you need to call the
recalc) and then Save at the end.


"Paige" wrote:

Here's the screnario: Only 1 file is open; it has formulas, but they have
all been calculated. There is no before_save (or before_close) code. When I
do file/save from the menu (and also from VB), Excel does not do a
recalculation; however, when I do file/save as from the menu (and also if I
do it from VB and even if I use Application.Calculation = xlCalculationManual
before the saveas command), it does a recalculation. 3 questions:

1) Why does it act differently between file/save and file save as?
2) Why is my Application.Calculation = xlCalculationManual command being
ignored?
3) How can I force it to NOT recalculate during saveas?


Paige

Background Processes in File Save versus File SaveAs
 
Thanks James! Like your option re saving the file also; will definitely use
this.

"James Snell" wrote:

1) The short answer is that Save and Save As are different code paths. The
same applies in most of the other office applications by the way. Useful to
remember if you have a troublesome document or workbook.

2) It is not being ignored. Many things which are derived from the file
content are discarded to ensure the saved file is clean, the result cache is
one of these items. To save the result cache it must be regenerated.

3) You cannot. But you could move the SaveAs - One option might be to do
your SaveAs at the beginning of your code (or when you need to call the
recalc) and then Save at the end.


"Paige" wrote:

Here's the screnario: Only 1 file is open; it has formulas, but they have
all been calculated. There is no before_save (or before_close) code. When I
do file/save from the menu (and also from VB), Excel does not do a
recalculation; however, when I do file/save as from the menu (and also if I
do it from VB and even if I use Application.Calculation = xlCalculationManual
before the saveas command), it does a recalculation. 3 questions:

1) Why does it act differently between file/save and file save as?
2) Why is my Application.Calculation = xlCalculationManual command being
ignored?
3) How can I force it to NOT recalculate during saveas?



All times are GMT +1. The time now is 08:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com