UserForm password masking not working

KarinG

New Member
Joined
Nov 17, 2017
Messages
6
Hi.
I created a UserForm that accepts a password. The property PasswordChar is set to *. This works great in Excel 2010. When I try using the form in Excel 2016 it does not work. The password is literally all asterisks. Any idea on what is happening and how I fix this? I really would like the password to be what I type in and not all stars. :)
Thanks for your help.
Karin
 

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Welcome to the forum!

I can not duplicate your problem. Both Value and Text properties return the proper string.
Code:
Private Sub CommandButton1_Click()
  MsgBox TextBox1.Value
End Sub
 
Upvote 0
Hi.
Thanks for the quick replies. My msgbox displays all asterisks.
Here is my code:
Code:
Private Sub cmdSubmit_Click()
    On Error GoTo PasswordError
        MsgBox txtPassword.Value
        For Each ws In ActiveWorkbook.Worksheets
            ws.Unprotect Password:=txtPassword.Value
        Next ws
        Me.Hide
        txtPassword.Value = ""
        MsgBox "All worksheets unlocked"
    Exit Sub
PasswordError:     MsgBox "Invalid password - please try again."
    txtPassword.Value = ""
    Me.txtPassword.SetFocusEnd Sub
 
Upvote 0
Do you have an initialize event for your userform?
Or any other code in the Userform module?
 
Upvote 0
There is no initialize event. The only other code in the module is this:
Code:
Private Sub UserForm_Activate()
    Me.txtPassword.SetFocus
End Sub

To call the form I use this code:
Code:
Sub UnProtectAllSheets()
    frmPasswordUnprotect.Show
End Sub
 
Upvote 0
Not sure why that's happening, & can't find anything on the net that's similar.
One possible option would be to delete the textbox & then put a new one on.
 
Upvote 0
I can try that. Thank you.

Are there any other properties that I should be checking? Or is PasswordChar the only property that is needed for passwords to be hidden?
 
Upvote 0
Just change the PasswordChar property
 
Upvote 0
I deleted the text field and added it back again. When I leave the PasswordChar field blank it works. As soon as I put a * in that property it doesn't work anymore.
 
Upvote 0

Forum statistics

Threads
1,223,229
Messages
6,170,881
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top