(Note: I have already posted this question in other groups but have not received any response)
My goal is to close a file without being prompted to save after changing a shape, specifically the size of a button; to this end, after changing the button, I set Thisworkbook.saved to True but if I close the file I am still prompted to save.
NB I don't want to turn off the warnings
NB in the real application, after changing the shape, the user can or cannot change other things before closing, so without this VBA reset I don't know if I have to save or not and I don't want to waste time and annoy the user if it's not the case
To reproduce the problem simply create an empty file, add a ActiveX control button on the sheet, save it and then
1) open the file
2) manually change the size of the button by pressing the button with the square (the design mode)
3) from the immediate window launch
4) optional, verify that this has had an effect by typing
5) it will answer "True"
6) try to close the sheet
it will ask if we want to save the changes!!!
7) answer Cancel
8) type again
it will answer "False" !!!
If instead of the command 3) you do a real save all it will work as expected (i.e. at point 6 the file will close without any questions)
So what else must be done in VBA to fully simulate the Save command?
My goal is to close a file without being prompted to save after changing a shape, specifically the size of a button; to this end, after changing the button, I set Thisworkbook.saved to True but if I close the file I am still prompted to save.
NB I don't want to turn off the warnings
NB in the real application, after changing the shape, the user can or cannot change other things before closing, so without this VBA reset I don't know if I have to save or not and I don't want to waste time and annoy the user if it's not the case
To reproduce the problem simply create an empty file, add a ActiveX control button on the sheet, save it and then
1) open the file
2) manually change the size of the button by pressing the button with the square (the design mode)
3) from the immediate window launch
VBA Code:
ThisWorkbook.Saved = True
VBA Code:
Debug.Print ThisWorkbook.Saved
6) try to close the sheet
it will ask if we want to save the changes!!!
7) answer Cancel
8) type again
VBA Code:
Debug.Print ThisWorkbook.Saved
If instead of the command 3) you do a real save all it will work as expected (i.e. at point 6 the file will close without any questions)
So what else must be done in VBA to fully simulate the Save command?