打印在文本框中输入的字符时,始终省略最后一个字符。尝试使用KeyUp事件,但它会在每次输入时触发Case Else。有什么想法吗?
Private Sub hoursOverBox_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
Select Case KeyAscii
Case 46, 48 To 57
Case Else
KeyAscii = 0
MsgBox "Only numbers allowed!"
End Select
Me.hoursOverBox.MaxLength = 5
On Error Resume Next
hoursOver = Me.hoursOverBox.value
End Sub
答案 0 :(得分:0)
更改此行:
ByVal KeyAscii As MSForms.ReturnInteger
到
ByVal KeyAscii As Integer