How to make Excel prompt me to save when closing?

When you close Excel and edit your VBA code, it does not suggest you save. I just wrote 300 lines of code and it was not saved.

How to make it prompt when closing?

+2
source share
3 answers

He should have suggested you save. Make sure SetWarnings are not installed somewhere in your code

+1
source

You can change SetWarnings settings as described by Kevin.

But I usually do all my excel autosave projects on exit.

, ThisWorbook:

:

Private Sub Workbook_BeforeClose(Cancel As Boolean)
    ThisWorkbook.Close SaveChanges:=True
End Sub

, , , , , !

+1

Add before executing a line of code:

response(msgbox("Do you want to save this copy of your file?",VByesNo,"")

if response =VBYes, then

line of code to save

Else

msgbox "File was not saved",vbOK,""

Exit Sub
End if
0
source

Source: https://habr.com/ru/post/1756038/


All Articles