If user knows to hit enter after the entering the password -
Private Sub TextBox1_KeyUp(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
Const PASSWORD = "cesame"
If KeyCode = vbKeyReturn Then
If LCase(TextBox1.Text) = PASSWORD Then
MsgBox "Password valid"
End If
End If
End Sub
Alternatively, simply -
Private Sub TextBox1_Change()
Const PASSWORD = "cesame"
If LCase(TextBox1.Text) = PASSWORD Then
MsgBox "Password valid"
End If
End Sub
I am assuming that when you select through Excel:
View-Toolbars-Control Toolbox
the controls you see are ActiveX controls - I could be wrong!
Indeed they are ActiveX controls.
Regards,
Peter T
"Chrisso" wrote in message
oups.com...
Hi Guys - thanks for your respones.
Bob - I am using an ActiveX control as I need the "PasswordChar"
property as what the user enters is a password required to initiate
some logic. When I try to add the KeyDown event to its code VB
complains and I think this is because the events list must be
different between ActiveX text boxes and Forms text boxes. How can I
get a list of ActiveX text box events? The Excel help facility only
seems to list events for Form text boxes.
Peter - As this is a "password" text box the user just hits enter and
does not select anything else so LostFocus wont help me on this one I
think.
So - to clarify my original question: How do I capture an "Enter" on
an ActiveX text box.
I am assuming that when you select through Excel:
View-Toolbars-Control Toolbox
the controls you see are ActiveX controls - I could be wrong!
Cheers
Chrisso