Select or Enter into a TextBox on a UserForm

  • Thread starter Thread starter RyanH
  • Start date Start date
R

RyanH

I am designing a Login Userform. If the user enters the wrong password I
want to delete the text they entered and then have the textbox selected so
they can begin typing automatically. Any suggestions would be great!
 
If TextBox1.Text <> "password" Then
MsgBox "Invalid Password", vbCritical
TextBox1.SetFocus
TextBox1 = ""
End If
 
Ahhhhhh. Stupid me, I had this:

If TextBox1.Text <> "password" Then
MsgBox "Invalid Password", vbCritical
TextBox1 = ""
TextBox1.SetFocus
End If

all I had to do is switch SetFocus and ""

Thanks for the help and the quick response
 
Hello Dan,
I used your code in a userform. When launched, the "OK" is selected, how to
get the text box to be selected and cursor blinking in it?
Thanks
 
Back
Top