Protecting a password
Posted by Thomas M. on December 13, 2001 7:09 AM
Hey everyone. Two (hopefully) quick questions:
1) How do I 'hide' a password as I enter it (or at least when it is viewed) , so that others can't just look at the VBA code for the password?
2) How do I make '*'s come up as someone types in a password into a VBA InputBox for protected parts of my program?
Just as an example, this is what I'm currently using for the password prompt (note below the 5th line that reveals the password, this is the issue for question #1) :
Sub GetPassword()
Dim Response As String, X As Integer
For X = 1 To 3
Response = InputBox("Enter your password", "Password")
If Response = "clearview" Then
Save ' Run Save Macro
Exit Sub
End If
If X = 3 Then
Response = MsgBox("Not the right password", vbCritical, "Password")
End If
Next X
End Sub
Sub Save()
'
' Save Macro
'
ActiveWorkbook.SaveAs Filename:="MyFileName"
End Sub
Any suggestions?
P.S. - this board is absolutely amazing. Much thanks to the site owner and all members; your collective tips have helped out immensely!\
-Thomas M