Private Sub workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim lReply As Long
Cancel = True
If SaveAsUI = True Then
[COLOR=red]lReply = MsgBox("Rat tiec, Ban khong duoc phep luu lai file nay bang mot ten khac." _
& "Ban muon luu lai khong?!", vbQuestion + vbYesNo, "Warning")[/COLOR]
If lReply = vbYes Then
Ans = InputBox("De luu file bang ten khac. Ban phai nhap Key ")
If Ans = 833486 Then Cancel = [COLOR=red]False[/COLOR]
End If
Else
'MsgBox " Ban khong the sua doi file nay", vbCritical, "Warning"
Ans = InputBox("De luu lai, Ban phai nhap key!")
If Ans = 833486 Then
Cancel = False
SaveAsUI = True
MsgBox "Su thay doi da duoc luu lai", vbInformation
Else
MsgBox " Su thay doi khong duoc luu lai", vbInformation
End If
End If
End Sub