|
檢驗身分證字號VBA程式
|
瀏覽1,190 |回應0 |推薦0 |
|
|
Rem === 檢驗身分證字號VBA程式 ===
Rem === 使用元件:CommandButton1, TextBox1, Label1,2,3
Dim id(10) As Integer
Private Sub CommandButton1_Click()
PL = Left(TextBox1.Text, 1)
Select Case (PL)
Case "A", "a": vv = "10": Label1.Caption = "居住地:台北市"
Case "B", "b": vv = "11": Label1.Caption = "居住地:台中市"
Case "C", "c": vv = "12": Label1.Caption = "居住地:基隆市"
Case "D", "d": vv = "13": Label1.Caption = "居住地:台南市"
Case "E", "e": vv = "14": Label1.Caption = "居住地:高雄市"
Case "F", "f": vv = "15": Label1.Caption = "居住地:台北縣"
Case "G", "g": vv = "16": Label1.Caption = "居住地:宜蘭縣"
Case "H", "h": vv = "17": Label1.Caption = "居住地:桃園縣"
Case "I", "i": vv = "34": Label1.Caption = "居住地:嘉義市"
Case "J", "j": vv = "18": Label1.Caption = "居住地:新竹縣"
Case "K", "k": vv = "19": Label1.Caption = "居住地:苗栗縣"
Case "L", "l": vv = "20": Label1.Caption = "居住地:台中縣"
Case "M", "m": vv = "21": Label1.Caption = "居住地:南投縣"
Case "N", "n": vv = "22": Label1.Caption = "居住地:彰化縣"
Case "O", "o": vv = "35": Label1.Caption = "居住地:新竹市"
Case "P", "p": vv = "23": Label1.Caption = "居住地:雲林縣"
Case "Q", "q": vv = "24": Label1.Caption = "居住地:嘉義縣"
Case "R", "r": vv = "25": Label1.Caption = "居住地:台南縣"
Case "S", "s": vv = "26": Label1.Caption = "居住地:高雄縣"
Case "T", "t": vv = "27": Label1.Caption = "居住地:屏東縣"
Case "U", "u": vv = "28": Label1.Caption = "居住地:花蓮縣"
Case "V", "v": vv = "29": Label1.Caption = "居住地:台東縣"
Case "W", "w": vv = "32": Label1.Caption = "居住地:金門縣"
Case "X", "x": vv = "30": Label1.Caption = "居住地:澎湖縣"
Case "Y", "y": vv = "31": Label1.Caption = "居住地:陽明山"
Case "Z", "z": vv = "33": Label1.Caption = "居住地:連江縣"
End Select
id(0) = Val(Left(vv, 1))
id(1) = Val(Right(vv, 1))
vv2 = id(0) + 9 * id(1)
For I = 2 To 9
id(I) = Mid(TextBox1.Text, I, 1)
vv2 = vv2 + (10 - I) * id(I)
Next I
If id(2) = 1 Then Label2.Caption = "性別:男" Else Label2.Caption = "性別:女"
id(10) = Right(TextBox1.Text, 1)
vv2 = vv2 + id(10)
If vv2 Mod 10 = 0 Then
Label3.Caption = "正確" & Str(vv2)
Else
Label3.Caption = "不正確" & Str(vv2)
End If
End Sub
|
|
|