I have following Input box for excel file. I don't want to show typing characters and need to show input box characters * , how to do this?
Private Sub Workbook_Open()
Dim UserName As String
UserName = InputBox("Please Enter Your USER NAME.")
Range("O1") = UCase(UserName)
End Sub
Thanks, Hewage
How to use Input Box in a VBA Code. Type “InputBox” and enter a space and you will get a tool for the arguments you need to define. Specify the “Prompt”, message that you want to show to the user. Define a title for the input box, otherwise, it will show the default title.
Creates an input box containing multiple lines (Create Excel VBA InputBox” & vbNewLine & “with multiple lines) with the InputBox function. Assigns the value returned by the InputBox function to a variable (myInputBoxMultipleLinesVariable = inputBox(…)). Displays a message box with the value held by the variable.
Input is a function in VBA that is used to read the files whether it is opened in binary or input mode. The result of this function is a string that returns the contents of the file.
Use a UserForm Create a userform that has a Textbox, and Two Buttons In the textbox Properties, enter * in the PasswordChar Box
Use the code below in the userForm module.
Private Sub CommandButton1_Click()
If TextBox1 = "123456" Then
MsgBox "Correct"
Else
MsgBox "Incorrect"
End If
Unload Me
End Sub
Private Sub CommandButton2_Click()
'cancel button
Unload Me
End Sub
Private Sub UserForm_Initialize()
Me.Caption = "Enter Password"
End Sub
Your userform will look like this
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With