Create UPC-E codes with 7-8 digit number

< Back
You are here:
Print

Create UPC-E codes with 7-8 digit number

Solution(s):

Feature Level 6 Font Tools add the functionality for 6, 7 or 8 digit numbers as the input for UPC-E. Download the latest tools or use the online font encoder.

In Feature Level 5 or lower versions of font tools, UPC-E barcodes may not be created correctly if the full UPC-A number is not entered. UPC-E encodes portions of the complete UPC-A within the barcode by using variable parity between character sets. Therefore, when using older versions of the products, enter the expanded 11 or 12 digit UPC-A number to create a UPC-E.

For example, a UPC-E number that is 02532038 scans as 025300000208 with a barcode scanner. For testing purposes, use 025300000208 as the UPC-A number. After this number passes through the barcode font tools, the text of U(C5D20D)x  is returned, which creates a UPC-E with the IDAutomation UPC/EAN barcode font. Only certain UPC-A numbers can be compressed to the UPC-E format.

The rules for decompression of UPC-E to UPC-A is available in the VBA 7to11 function. The following is the VBA code that performs this conversion:

Private Function UPCe7To11(DataToExpand As String) As String
StringLength = Len(DataToExpand)
If StringLength = 6 Then DataToExpand = "0" & DataToExpand
'Expect 7 digits; the first digit is the number system
If StringLength <> 7 Then DataToExpand = "0000000"
Dim D1 As String
Dim D2 As String
Dim D3 As String
Dim D4 As String
Dim D5 As String
Dim D6 As String
Dim D7 As String
D1 = Mid(DataToExpand, 1, 1)
D2 = Mid(DataToExpand, 2, 1)
D3 = Mid(DataToExpand, 3, 1)
D4 = Mid(DataToExpand, 4, 1)
D5 = Mid(DataToExpand, 5, 1)
D6 = Mid(DataToExpand, 6, 1)
D7 = Mid(DataToExpand, 7, 1)
Select Case D7
Case "0"
UPCe7To11 = D1 & D2 & D3 & "00000" & D4 & D5 & D6
Case "1"
UPCe7To11 = D1 & D2 & D3 & D7 & "0000" & D4 & D5 & D6
Case "2"
UPCe7To11 = D1 & D2 & D3 & D7 & "0000" & D4 & D5 & D6
Case "3"
UPCe7To11 = D1 & D2 & D3 & D4 & "00000" & D5 & D6
Case "4"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & "00000" & D6
Case "5"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & D6 & "0000" & D7
Case "6"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & D6 & "0000" & D7
Case "7"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & D6 & "0000" & D7
Case "8"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & D6 & "0000" & D7
Case "9"
UPCe7To11 = D1 & D2 & D3 & D4 & D5 & D6 & "0000" & D7
End Select
End Function