password protection

N

Neil_Pattison

I have used the following code to set up a simple inputbox for a user to
enter a password in to access a report

Dim PW As String

PW = InputBox("Please enter the password")
If PW = "THEPASSWORD" Then
Else
MsgBox "That's not correct"
Cancel = True
Exit Sub
End If

How can I add into this code something so that the inputbox uses the
input mask for a password so it shows on screen as *****?
 
P

Patrick Simonds

I was doing something similar but found that you could get around the
Password UserForm by clicking on the X on the upper right corner. It was
suggested by someone that I use the following code to keep that from
happening:

Private Sub UserForm_QueryClose _
(Cancel As Integer, CloseMode As Integer)
' Prevents use of the Close button
If CloseMode = vbFormControlMenu Then
MsgBox "Clicking the Close button does not work."
Cancel = True
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top