I
Izar Arcturus
Has anyone else encountered this? Why does this happen?
What can I do so that I can still delete the sheets that I
need to and not have to save twice?
Well, after a bit of testing, it seems I have determined
why - when the user goes to close the Excel file produced
by my marco - that the user is prompted to save "changes"
again after the macro had already used SaveAs to get the
user to save the file before the macro finished running.
These inexplicable "changes" do not need to be saved again
after the macro is done, and the user is closing the Excel
file; when I get rid of a series of delete statements
which occur near the end of the macro but before the
SaveAs statement. The lines look like the following:
Application.DisplayAlerts = False
Worksheets(2).Delete
Worksheets(3).Delete
Worksheets(4).Delete
Application.DisplayAlerts = True
It's as if the deleting of these sheets does not finish
before the SaveAs has finished or even the macro has
finished.
I have even tried peppering the code after the SaveAs line
with a few Save statements. I have also employed the
suggestion received from my last post to include the
following line:
ActiveWorkbook.Saved = True
But this does not seem the be the solution either. Please
let me know you thoughts on this. Thank you.
What can I do so that I can still delete the sheets that I
need to and not have to save twice?
Well, after a bit of testing, it seems I have determined
why - when the user goes to close the Excel file produced
by my marco - that the user is prompted to save "changes"
again after the macro had already used SaveAs to get the
user to save the file before the macro finished running.
These inexplicable "changes" do not need to be saved again
after the macro is done, and the user is closing the Excel
file; when I get rid of a series of delete statements
which occur near the end of the macro but before the
SaveAs statement. The lines look like the following:
Application.DisplayAlerts = False
Worksheets(2).Delete
Worksheets(3).Delete
Worksheets(4).Delete
Application.DisplayAlerts = True
It's as if the deleting of these sheets does not finish
before the SaveAs has finished or even the macro has
finished.
I have even tried peppering the code after the SaveAs line
with a few Save statements. I have also employed the
suggestion received from my last post to include the
following line:
ActiveWorkbook.Saved = True
But this does not seem the be the solution either. Please
let me know you thoughts on this. Thank you.