![]() |
cancel save
i want a pre-save program to check if there is a value in cell a1 before
someone saves. if there is, and user clicks 'No' then it will cancel saving. thank you Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Range("a1") = 1 Then aaa = MsgBox("Are you Sure?", vbCritical + vbYesNo, "Dont want to Ruin Template!") If aaa = vbNo Then ... end sub |
cancel save
Hi lawson.
If you look at the help on line you will find: Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, _ Cancel as Boolean) a = MsgBox("Do you really want to save the workbook?", vbYesNo) If a = vbNo Then Cancel = True End Sub Regards Eliano "lawson" wrote: i want a pre-save program to check if there is a value in cell a1 before someone saves. if there is, and user clicks 'No' then it will cancel saving. thank you Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean) If Range("a1") = 1 Then aaa = MsgBox("Are you Sure?", vbCritical + vbYesNo, "Dont want to Ruin Template!") If aaa = vbNo Then ... end sub |
All times are GMT +1. The time now is 12:25 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com