Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim data as string
- Dim chk as number
- data = {Opdracht.Barcode}
- chk = 0
- Dim Result As String
- Dim datalength as Number
- Dim barcodechar As String
- Dim barcodevalue as Number
- Dim filtereddata As String
- Dim filteredlength As Number
- Dim CODE39MAP() As Number
- CODE39MAP = Array(Asc("0"), Asc("1"), Asc("2"), Asc("3"), Asc("4"), Asc("5"), Asc("6"), Asc("7"), Asc("8"), Asc("9"), Asc("A"), Asc("B"), Asc("C"), Asc("D"), Asc("E"), Asc("F"), Asc("G"), Asc("H"), Asc("I"), Asc("J"), Asc("K"), Asc("L"), Asc("M"), Asc("N"), Asc("O"), Asc("P"), Asc("Q"), Asc("R"), Asc("S"), Asc("T"), Asc("U"), Asc("V"), Asc("W"), Asc("X"), Asc("Y"), Asc("Z"), Asc("-"), Asc("."), Asc(" "), Asc("$"), Asc("/"), Asc("+"), Asc("%"))
- Dim x as number
- Dim z as number
- Dim RVal As Number
- Dim getCode39Value as Number
- Result = ""
- datalength = Len(data)
- For x = 1 To datalength
- barcodechar = Mid(data, x , 1)
- barcodevalue = AscW(barcodechar)
- RVal = -1
- getCode39Value = -1
- For z = 1 To 43
- If CODE39MAP(z) = barcodevalue Then
- RVal = (z-1)
- End If
- Next z
- getCode39Value = RVal
- If getCode39Value <> -1 Then
- Result = Result + barcodechar
- End If
- Next x
- filtereddata = Result
- filteredlength = Len(filtereddata)
- If chk = 1 Then
- If filteredlength > 254 Then
- filtereddata = Left(filtereddata, 254)
- End If
- filteredlength = Len(filtereddata)
- Dim Sumx as number
- Dim ResultVal as number
- Dim cd as string
- Sumx = 0
- For x = 1 To filteredlength
- barcodechar = Mid(filtereddata, x, 1)
- barcodevalue = AscW(barcodechar)
- RVal = -1
- getCode39Value = 0
- For z = 1 To 43
- If CODE39MAP(z) = barcodevalue Then
- RVal = (z-1)
- End If
- Next z
- getCode39Value = RVal
- Sumx = Sumx + getCode39Value
- Next x
- ResultVal = Sumx Mod 43
- cd = ChrW(CODE39MAP(ResultVal+1))
- Else
- If filteredlength > 255 Then
- filtereddata = Left(filtereddata, 255)
- End If
- cd = ""
- End If
- Result = "*" + filtereddata + cd + "*"
- formula = Result
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement