Only allows a specified set of characters to be typed into a text box.
Function LimitTextInput(ByVal source As Integer, _ Optional ByVal limitTo As String = "0123456789.") As String 'put the next line in the Textbox_KeyPress event 'KeyAscii = LimitTextInput(KeyAscii) 'backspace = 8 If source <> 8 Then If InStr(limitTo, Chr(source)) = 0 Then LimitTextInput = 0 Exit Function End If End If LimitTextInput = source End Function
