Can anyone please help me with this question?
How to create an ActiveX control which allows the user to input values between 1 to 100 inclusive?
Thanks!
Printable View
Can anyone please help me with this question?
How to create an ActiveX control which allows the user to input values between 1 to 100 inclusive?
Thanks!
I don't know if I'd even bother with an activeX control for that, just use a text box and add this code
modify it to your needsCode:Option Explicit
Private Sub Form_Load()
Text1.Text = 0
End Sub
Private Sub Text1_Change()
Static strOldText As String
On Error GoTo ERR_NOTNUMBER:
If Text1.Text = "" Then Text1.Text = 0
If CByte(Text1.Text) > 100 Then Err.Raise 1
strOldText = Text1.Text
Exit Sub
ERR_NOTNUMBER:
Text1.Text = strOldText
Text1.SelStart = Len(Text1.Text)
End Sub