How to Mask Password in VBA Excel Input Box?
Last Updated :
23 Jan, 2023
A combination of integers, strings of characters, or other symbols is used to verify the identity of a user during the authentication process so, that they can access the system. But a password should always remain in a hidden format to prevent it from shoulder spying. Shoulder spying is a practice where a person collects our personal data by spying over our shoulders in Cyber Cafe or ATM. Let's learn how to hide the password for that we need to mask the password in Excel Input Box.
Steps to Mask Password in VBA Excel Input Box
Follow the further steps to create a masked password in VBA:
Step 1: Press Alt+F11 in the Excel window to get the VBA window.
Step 2: Select Insert in the Ribbon tab of the VBA code window.
Step 3: Then click on UserForm to get the toolbox and user form.
Step 4: Select CommandButton from Toolbox.
And then drag it to the UserForm1 tab.
Step 5: Select TextBox from the toolbox and then drag it to UserForm1.
Step 6: Press F4 to get the Properties Window.
Step 7: Change the name of the Text Box to "txtPassword"
Step 8: Now, scroll down the Properties tab of txtPassword to assign a value of asterisk(*) in PasswordChar to create a password mask.
Step 9: In the drop-down box select CommandButton1.
Step 10: Change the name of the CommandButton to CmdInput and Caption name to Submit.
Step 11: Change the caption name in the Properties - UserForm1 tab to Password.
Step 11: Double-click on Submit button of the Password form.
Step 12: Write the following code to see the password in the Message Box.
Unload Me is used to close the form and remove its details from the memory. Now, to run the code press F5.
Step 13: Enter the password which will be hidden in the Excel window
Step 14: Click on Submit button so that we can see the password in the message box
Similar Reads
How to Manage Passwords using MS Excel? Spreadsheets are another name for Excel sheets. Microsoft Excel was created in 1985 for Apple's Macintosh computer. The data is arranged into rows and columns. Excel sheets containing endless data can be created. There would be n rows and n columns, allowing us to store millions and crores of record
2 min read
How to Insert and Run VBA Code in Excel? In Excel VBA stands for (Visual Basic for Application Code) where we can automate our task with help of codes and codes that will manipulate(like inserting, creating, or deleting a row, column, or graph) the data in a worksheet or workbook. With the help of VBA, we can also automate the task in exce
2 min read
VBA Subroutine in Excel - How to Call Sub in VBA? When a specified action is performed on a worksheet with the help of a collection of code known as a VBA Subroutine. It also helps to read an external file, also it can open other applications from Excel. A large piece of code can be broken into small parts so that we can manage it easily. Let's lea
2 min read
How to Delete a Module in Excel VBA? Have you ever seen a text file in a notepad or a source code file in visual studio code? These all are just basic files where you can write some code or information. Similarly, we have modules in excel, each module has its code window, where you can write some code and allow it to automate your repe
3 min read
How to Create an Input Box With Multiple Inputs in Excel Using VBA? The Input Box is a dialogue box that helps users to take a value and do later computations according to the entered value. The input box is similar to the message box, but the message box is used to display the data while the input box is used to enter the data. By default, a message box displays on
10 min read
How to Password Protect Your Excel Macro? It is a best practice, to protect the Macro (VBA Code) from other users to edit or view. In this article, we explain to create a simple macro and protect the same "VBA Project" using a password in Excel from other users. Implementation: Follow the below steps to protect your excel macro with a passw
2 min read