Thread: cancel save
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
lawson lawson is offline
external usenet poster
 
Posts: 44
Default 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