Problem with password security
I imagine it's the GetPassword routine that's giving you the input box at
which you can click Cancel. Input boxes return an empty string ("") if you
click cancel so why not hide the Admin sheet again if this is returned:
Private Function GetPassword() As Variant
GetPassword = InputBox(Prompt:="Please enter correct Password")
If GetPassword="" Then
Sheets("Admin").Visible = False
End If
End Function
This leaves the problem of what happens with the rest of the
Unprotect_Workbook routine. You could do the following
....
....
Do
myPwd = GetPassword
If myPwd = "" Then Exit Sub
ws.Unprotect Password:=myPwd
....
....
|