Excel VBA输入框 [英] Excel VBA Input box
本文介绍了Excel VBA输入框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我对Excel文件有以下输入框.我不想显示键入字符,而需要显示输入框字符*,该怎么做?
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
谢谢, w
推荐答案
使用用户窗体 创建一个具有文本框和两个按钮的用户窗体 在文本框的属性中,在PasswordChar框中输入*
Use a UserForm Create a userform that has a Textbox, and Two Buttons In the textbox Properties, enter * in the PasswordChar Box
使用下面的userForm模块中的代码.
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
这篇关于Excel VBA输入框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文