Try below. However, if Excel is exited and re-opened, the user gets
new lease of life for another 3 attempts.
Public Sub PasswordOK_Click()
Dim Password As String
Dim count As Integer
STATIC CN
CNT = CNT+1
IF CNT =3 THEN EXIT SU
Password = "*SESAME*"
If TextBox1 = Password Then
Personal_Details.Show
Unload Me
End If
If TextBox1 < Password Then
TextBox1 = ""
Label1.Visible = True
PasswordOK.Visible = False
PasswordCancel.Visible = False
Application.Wait Now + TimeValue("00:00:02")
Label1.Visible = False
PasswordOK.Visible = True
PasswordCancel.Visible = True
End If
End Su
--
david
-----------------------------------------------------------------------
davidm's Profile:
http://www.excelforum.com/member.php...fo&userid=2064
View this thread:
http://www.excelforum.com/showthread.php?threadid=48306