数字小键盘上的是 vbKeyDecimal (110)
大键盘上没有常量代号你可以直接用(190)

解决方案 »

  1.   

    ASCII 码为46可以用i=asc("."),得到ASCII值
      

  2.   

    给你我私藏的函数
    'KeyAscii = ValiText(KeyAscii, "0123456789/-", True)  调用方法
    '只接受第二个参数提供的字符
    '即:"0123456789/-", 而此函数的第三个函数就决定了能否使用 [Backspace] 键。
    '此函数对大小写是不敏感的Function ValiText(KeyIn As Integer, ValidateString As String, Editable As Boolean) As Integer
    Dim ValidateList As String
    Dim KeyOut As Integer
    If Editable = True Then
       ValidateList = UCase(ValidateString) & Chr(8)
    Else
       ValidateList = UCase(ValidateString)
    End If
    If InStr(1, ValidateList, UCase(Chr(KeyIn)), 1) > 0 Then
       KeyOut = KeyIn
    Else
       KeyOut = 0
       Beep
    End If
    ValiText = KeyOut
    End Function