Function getnewidcard (byval old)
'-- Input parameter --
'Old in int, -- the two-digit age generated. The default value is 19 years.
'-- Output parameter --
'Getnewidcard -- 18-digit random ID card. The birthdate is the current year, month, and old year, and the last four are random.
'---------------------------------------------------------------
'-- Module name: getnewidcard
'-- Description: generate an 18-digit random ID card. The birthday is the current year, month, day, old year, and the last four are random.
'---------------------------------------------------------------
'-- Modify
'-- Modification date:
'-- Modify content:
'-----------------------------------------------------------------
'-- Input parameter judgment. If it is null, the default value is 18.
If old = "" then
Old = 19
End if
Dim I, S, WI, WF, result
Dim idcard17
Dim today
'-- Generates the specified yymmdd based on the current date.
Today = Date
Yymmdd = (Year (today)-old) & right ("0" & month (today), 2) & right ("0" & Day (today), 2)
'-- Generate a three-digit random number
Serrnd = int (900 * RND + 100)
'-- Combined into 17 ID card numbers
Idcard17 = "230202" & yymmdd & serrnd
'-- Generate ID card verification code
Wi = Split)
WF = Split (", X)
S = 0
For I = 0 to ubound (WI)
S = CINT (WI (I) * CINT (mid (idcard17, I + 1, 1) + S
Next
'-- Combine them into 18-digit ID cards
Getnewidcard = idcard17 & WF (CINT (S mod 11 )))
End Function