Friday, July 1, 2016

Crap libreoffice macro function to do code128

so it's way too hard to do by hand, why not write a simple macro to convert a string to code128 table b for the font from http://grandzebu.net/informatique/codbar-en/code128.htm

and BEEP! my barcode scanner likes it.


function calcstring(x as string)
a=x
checksum = 104 'symbol for 209
for position = 1 to len(a)
checksum = checksum+(asc(mid(a,position,1))-32)*position
next position
checksum = checksum mod 103

calcstring = chr(209)+a+chr(checksum+32)+chr(211)
'start code B, then string, then checksum, then stop code
end function

No comments:

Post a Comment