Put this code in the workbook (change the password as required):
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
Dim Password As String
Dim EnteredPassword As String
Password = "Barrie"
EnteredPassword = InputBox("Enter password to save changes")
If EnteredPassword <> Password Then
Cancel = True
MsgBox ("Password incorrect, file not saved")
End If
End Sub
Copyright ©
2001 by Barrie R. Davidson
Added February, 2002