ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   password protection (https://www.excelbanter.com/excel-programming/341804-password-protection.html)

Neil_Pattison[_2_]

password protection
 

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 *****?


--
Neil_Pattison
------------------------------------------------------------------------
Neil_Pattison's Profile: http://www.excelforum.com/member.php...o&userid=27696
View this thread: http://www.excelforum.com/showthread...hreadid=472890


Patrick Simonds

password protection
 
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



"dominicb" wrote in
message ...

Good morning Neil Pattison

To do this you are probably better off using a textbox on a userform
and set the PasswordChar property to "*". That is certainly the easier
way.

However, if you really want to continue using an input box, Daniel
Klann has devised a way to get around the problem by using a series of
API calls to intercept and translate the key presses. See his article
he

http://www.xcelfiles.com/API_09.html

HTH

DominicB


--
dominicb
------------------------------------------------------------------------
dominicb's Profile:
http://www.excelforum.com/member.php...o&userid=18932
View this thread: http://www.excelforum.com/showthread...hreadid=472890





All times are GMT +1. The time now is 07:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com