masking password when asking for it with *********

Jeff12

New Member
Joined
Aug 28, 2011
Messages
16
my code is below, I just need to understand how to mask the password entered as *******? just to stop other users seeing it next to me.

thanks in advance

Sub Openall()


Dim password As Variant
password = Application.InputBox("Enter Password", "Password Protected")


Select Case password
Case Is = False
'do nothing
Case Is = "Password"






Worksheets("1").Visible = True
Worksheets("2").Visible = True
Worksheets("3").Visible = True
Worksheets("4").Visible = True




Case Else
MsgBox "Incorrect Password"
End Select


End Sub
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
When you've completed the steps from article that Joe shared, do this:

1. Create a public variable in your existing module by declaring it outside of all functions/subrouties at module level.
Code:
Public gUserPassword as String

2. Replace statement of call to InputBox
Code:
password = Application.InputBox("Enter Password", "Password Protected")

with statement to show userform you just created:
Code:
UserForm1.Show

3. Assign value to global variable in button click function of the userform dialog box created.
Code:
Private Sub CommandButton1_Click()
[COLOR=#0000FF]    gUserPassword = Me.TextBox1[/COLOR]
End Sub
 
Last edited:
Upvote 0
When you've completed the steps from article that Joe shared, do this:

1. Create a public variable in your existing module by declaring it outside of all functions/subrouties at module level.
Code:
Public gUserPassword as String

2. Replace statement of call to InputBox
Code:
password = Application.InputBox("Enter Password", "Password Protected")

with statement to show userform you just created:
Code:
UserForm1.Show

3. Assign value to global variable in button click function of the userform dialog box created.
Code:
Private Sub CommandButton1_Click()
[COLOR=#0000FF]    gUserPassword = Me.TextBox1[/COLOR]
End Sub

cool thanks
 
Upvote 0

Forum statistics

Threads
1,223,738
Messages
6,174,213
Members
452,551
Latest member
croud

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