Note that Mart's method will not work if the user pastes text using the right-click pop-up menu. Note also that Mart's method prevents the user from pressing backspace (ASCII char 8, I think).
Code:
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Asc("0") To Asc("9"), 8 'Allow backspace
' Do nothing
Case Else
KeyAscii = 0
End Select
End Sub
Private Sub Text1_Change()
Dim i as Long, sTemp as String
For i = 1 To Len(Text1)
If Instr(1, "0123456789", Mid$(Text1, i, 1)) > 0 Then sTemp = sTemp & Mid$(Text1, i, 1)
Next
Text1 = sTemp
End Sub
That ought to do it. Mind you, I don't currently have VB installed, so the counting might be off, in which case, change "For i = 1" to "For i = 0". Hopefully, though, it's right. Stupid 1-based counting.