function idcode15to18(scode15 as string) as string '* 功能:将15的身份证号升为18位(根据gb 11643-1999) '* 参数:原来的号码 '* 返回:升位后的18位号码 dim i as integer dim num as integer dim code as string num = 0 idcode15to18 = left(scode15, 6) + "19" + right(scode15, 9) ' 计算校验位 for i = 18 to 2 step -1 num = num + (2 ^ (i - 1) mod 11) * (mid(idcode15to18, 19 - i, 1)) next i num = num mod 11 select case num case 0 code = "1" case 1 code = "0" case 2 code = "x" case else code = trim(str(12 - num)) end select idcode15to18 = idcode15to18 + code end function