Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

Before Save event

Private Sub workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)       Dim lReply As Long       If SaveAsUI = True Then       lReply = MsgBox("Do you wish to save this workbook?", vbQuestion + vbOKCancel)       Cancel = (lReply = vbCancel)       If Cancel = False Then Me.Save           Cancel = True       End If End Sub