根据http://www.phpvim.net/web/javascript/ean-13-barcode-check-digit.html所写
2.求奇数位之和
3.求偶数位之和,结果乘以 3
4.第 2、3 步,2 个计算结果相加
5.第 4 步的结果取个位数,用 10 减去个位数得到的数字,即是校验码
6.第 5 步个位数为 0 的话,校验码也是 0
lcBarCode = "123456789012"
lnLen = Len(lcBarCode)
s1 = 0
s2 = 0
For n=1 To lnLen
If n%2 =1
s1 = s1 + Val(Substr(lcBarCode,n,1))
Else
s2 = s2 + Val(Substr(lcBarCode,n,1))
Endif
Endfor
s2 = s2 * 3
Messagebox(10 - (s1+s2)%10)