ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Prompted to save changes after macro save - why? (https://www.excelbanter.com/excel-programming/285046-prompted-save-changes-after-macro-save-why.html)

Izar Arcturus

Prompted to save changes after macro save - why?
 
At the end of the marco I have written for Excel, I have
included code that allows the user to save the file that
has been created. But, after the user saves the file, the
macro ends, and the user goes to close the file that has
just been saved; a dialog box with an alert message
appears asking if you want to save the changes to the file.

If the user does not save the changes to the file(a second
save) then when the file is opened later Excel crashes.
This does not happen in all the macros that I have written
and I have been trying to figure out why it happens with
some but not others.

Does anyone know why this happens? How can I write my code
so that the save executed by the macro is enough?

No Name

Prompted to save changes after macro save - why?
 
How can I write my code so that the save executed by the
macro is enough?

try setting the saved property to true.

activeworkbook.saved = true

Izar Arcturus

More Help Please - Prompted to save changes after macro save - why?
 
Thanks for the suggestion. I put the following line after
the code that gets the user to save their file:

ActiveWorkbook.Saved = True

But the problem persists. A dialog box with an alert
asking if I want to save the changes to the file still
appears as if the file had not been just saved.

Could there be some execution of code that has not
finished or something? Could there be some "changes" still
occurring to the file after the macro saves it? Your
thoughts on this are appreciated.


-----Original Message-----
How can I write my code so that the save executed by the

macro is enough?

try setting the saved property to true.

activeworkbook.saved = true
.



All times are GMT +1. The time now is 05:07 PM.

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