PDA

Click to See Complete Forum and Search --> : Passwords


Basildon
Dec 13th, 1999, 12:24 AM
I have created a spreadsheet in Excel that when opened shows a message box asking for a password. How can I get it so that when the password is entered only stars/asteriks are shown.
Also how can I make it so that if the correct password is not entered after 3 attempts the application is closed down.

QWERTY
Dec 13th, 1999, 01:34 AM
To make that stars kind of thing use PasswordChar Property of the TextBox (I assume that you use TextBox in your App). Set it to * (Star)

For you second question:
Try this:

Private Sub CmdCheckPassword_Click()
Static Counter As Integer

If TxtPass <> "MYPASSWORD" then
Counter=Counter + 1
Else
'Do whatever you want to do when user enters correct password
End If

If Counter = 3 Then End
End Sub

It should do the job.
I hope this helps
Regards QWERTY

------------------
Visual Basic Programmer
------------------
PolComSoft
You will hear a lot about it.

[This message has been edited by QWERTY (edited 12-13-1999).]

MartinLiss
Dec 13th, 1999, 01:37 AM
Just in case you are not aware of it, Excel already has a built-in password protection scheme that does some of what you want. Take a look at File>Save As>Options.


------------------
Marty