123456789101112131415161718192021Private Sub Command1_Click()If Not IsNumeric(Text1.Text) ThenMsgBox "輸入非數值資料,請重新輸入", , "資料檢驗"Text1.Text = ""Text1.SetFocusExit Sub "退出此過程End IfDim t%, a%, b%, c%t = Val(Text1.Text)If t > 999 Or t < 100 ThenMsgBox "請正確輸入三位數", , "資料檢驗"Text1.Text = ""Text1.SetFocusExit Sub "退出此過程End If a = t Mod 10b = (t Mod 100) \ 10c = t \ 100Text2.Text = a * 100 + b * 10 + cEnd Sub
用Exit Sub退出Sub過程
123456789101112131415161718192021Private Sub Command1_Click()If Not IsNumeric(Text1.Text) ThenMsgBox "輸入非數值資料,請重新輸入", , "資料檢驗"Text1.Text = ""Text1.SetFocusExit Sub "退出此過程End IfDim t%, a%, b%, c%t = Val(Text1.Text)If t > 999 Or t < 100 ThenMsgBox "請正確輸入三位數", , "資料檢驗"Text1.Text = ""Text1.SetFocusExit Sub "退出此過程End If a = t Mod 10b = (t Mod 100) \ 10c = t \ 100Text2.Text = a * 100 + b * 10 + cEnd Sub