北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
老师帮看一下用这个转换的条码扫描出来多了一个0,不知道是为什么?
Function ToCode128C(ByVal s As String) As String
' zhuyiwen 2010.10.12
' 使用code128.ttf字体生成Code128C条码
Dim ns As String
Dim total As Long
If Len(s) > 0 And IsNumeric(s) Then
total = 105 ' Start Code
If Len(s) Mod 2 > 0 Then s = s + "0" ' 不足偶数位补0
Dim i As Integer, l As Integer
l = Len(s) \ 2
For i = 0 To l - 1
ns = ns + getChar(Mid(s, i * 2 + 1, 2))
total = total + (i + 1) * Val(Mid(s, i * 2 + 1, 2))
Next
Dim checkCode As String '生成验证码
checkCode = "" & (total Mod 103)
ns = ChrW(205) + ns + getChar(checkCode) + ChrW(206)
ToCode128C = ns
End If
End Function
Function getChar(ByVal s As String) As String
Dim c As Integer
c = Val(s)
If c = 0 Then
getChar = " "
ElseIf c < 95 Then
getChar = Chr(Asc("!") + c - 1)
Else
getChar = ChrW(100 + c)
End If
End Function