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