Modifying Code so * shows up in password box

bamaisgreat

Well-known Member
Joined
Jan 23, 2012
Messages
831
Office Version
  1. 365
Platform
  1. Windows
The code below shows the password as it is entered. Could someone show me how to edit it were it will just show the *. This is for a specific macro Im protecting.

Dim pass As String
pass = "bama" 'Change this to whatever your password needs to be
If Not InputBox("Enter Password", "Password") = pass Then Exit Sub
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
You should create a userform, then it's one of the properties of a textbox:

PasswordChar

And you can set it to what you want.
 
Upvote 0
In my situation im just using a key comination to run the Macro (ctrl + shift + k). Im just trying to make sure it is not run accidentaly.
 
Upvote 0
The only way, AFAIK, to hide the characters as you type them is to change the inputbox to a custom userform and use the property PasswordChar as outlined above.

To stop it from being run accidentally, why don't you try adding a button or other clickable to the workbook rather than use key combinations?
 
Upvote 0
Ill give it a try. Do you possible no some code to get me started? Maybe were i can click on a button and the user form pop up and be ready for password to be entered.
 
Upvote 0
private sub showPasswordbox

fPassword.show

End sub

Where fPassword is the name of your userform.
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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