Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Password mask

Status
Not open for further replies.

RFeniuk

Technical User
May 7, 2003
20
IN
I have a button in Excel that I want to password protect. I have the code to protect it but what is the code to show "*" instead of the actual password. Help.
 
Presumably you want to enter the password in a text box ... not on a button. If so, in design view, right click on the text box, select "Code View" and create a sub with the following
Code:
Private Sub TextBox1_GotFocus()
    TextBox1.PasswordChar = "*"
End Sub
 
Actually what I have is control button that runs a macro in Excel when it is clicked. I want to have a text box pop up that asks for a password before the code is run. I have the following code in right now but when I type the password it shows the password.

mPass = InputBox("Please enter password to run macro")
If mPass <> &quot;password&quot; Then
MsgBox &quot;Incorrect password&quot;
Exit Sub
Else


 
Tell you the truth, I don't have a clue how to do this in an input box, but you could call a modal dialog with a text box whose "Password Char" in properties in set to * (or any other character). You could also hide a text box and label on your exsting for and when your magic button is clicked, make them both visible and set focus to the password text box.

Not elegant, but quick and effective...

Let me know if this helps...

Best regards,

Jerry
 

If Excel "InputBox" is the VBS usual "InputBox" you have not a way to do it without resorting to FindWindow hackings and multithreading programming (what are not worth the work).

Use the methods Jerry propossed.

buho (A).
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top