View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Chip Pearson Chip Pearson is offline
external usenet poster
 
Posts: 7,247
Default VBA how can I stop a Save

Set the Cancel argument to True. E.g.,


Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean,
Cancel As Boolean)
If Range("C10") = "" Then
MsgBox "Please complete cell C10"
Cancel = True
Exit Sub
End If
End Sub


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"newboy18" wrote in message
...
I would like to stop users from saving a workbook if a
cells contents have not been completed, I know that I can
use the Event BeforeSave to do a test on the contents of a
cell but how can I stop the save

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean,
Cancel As Boolean)
If Range("C10") = "" Then
MsgBox "Please complete cell C10"
Exit Sub
End If
End Sub