Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Form_Load()
Text1.Text = ""
Text1.MaxLength = 9
End Sub
Private Sub Text1_Change()
If (Right(Text1.Text, 1) < "0" Or Right(Text1.Text, 1) > "9") And Text1.Text <> "" Then
MsgBox "请输入0—9的数字!"
Text1.Text = Left(Text1.Text, Len(Text1.Text) - 1)
Text1.SelStart = Len(Text1.Text)
End If
End Sub
界面拉个文本框(text)就行