更新时间:2023-12-03 09:55:22
您应该使用KeyPress
事件而不是Change
事件:
You should use KeyPress
event instead of Change
event:
Private Sub TextBox1_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If Len(Me.SomeTextBox.Value) = 3 And KeyAscii <> 8 Then 'Backspace has keycode = 8.
<.......Code Here>
Else
<.......Code Here>
End If
End Sub
您可以在此处找到完整的键控代码列表: http://www.asciitable.com/
Full list of keycodes you can find here: http://www.asciitable.com/