protection macro
Try this exactly, it should work:
Sub CPS()
Sheets("DATA_SHEET").Select
On Error Goto BadPW
ActiveSheet.Unprotect
On Error Goto 0
ActiveSheet.Protect
Sheets("POSTING_SHEET").Select
On Error Goto BadPW
ActiveSheet.Unprotect
On Error Goto 0
ActiveSheet.Protect
ActiveWorkbook.Save
ActiveWindow.Close
Exit Sub
BadPW:
MsgBox "Invalid Password!", vbOKOnly + vbExclamation
End Sub
-----Original Message-----
Thanks everyone for your quick response!
Peter, I have no Idea how to enter your script into the
macro.
Jack, It still pops up with "invalid password" even when
it is correct.
Here is what I'm working with to give you a better idea:
Sub CPS()
Sheets("DATA SHEET").Select
On Error GoTo BadPW
ActiveSheet.Unprotect ("password")
BadPW:
MsgBox "Invalid Password!", vbOKOnly + vbExclamation
Exit Sub
ActiveSheet.Protect ("password")
Sheets("POSTING SHEET").Select
ActiveSheet.Unprotect ("password")
ActiveSheet.Protect ("password")
ActiveWorkbook.Save
ActiveWindow.Close
End Sub
Where should I place your script? How should I modify it?
Thanks in advance!
Labrat
.
|