Note: This reply contains many hyperlinks for clarity. DUN14, DUN 14, and DUN-14 are equivalent. For ease we will refer to it as DUN14 for the remainder of the post.
To produce DUN14, the Code 128 Barcode Font Package, use the VBA Barcode Font Encoder (to encode the data in Excel), and format the data itself as follows:
GS1-128 data formatting will be used with an Application Identifier (AI) of 01. To encode the GS1 data, we will be using the Tilde Method, as it is the most robust method for international use. Following IDAutomation's naming conventions, DataToEncode is the data to be represented in the barcode itself.
1. GS1 AI: ~21201 is equivalent to an AI of (01)
There are a total of 12 digits in the data of a DUN14 barcode, excluding the GS1 AI and the mod10 check digit (below).
DUN14 defines the first digit in this section as a Container Code which refers to the quantity of items (units) being shipped. Please refer to the DUN14 specifications for details. In this example, we will use 4, which signifies 20 items.
The remaining 11 digits is the value of the barcode itself for the above (20) items. We will be using the generic value of 12345678912.
The combined DataToEncode = 412345678912
3. Modulo 10 (mod10) Check Digit:
DUN14 specifies that a mod10 check digit is to be calculated on the DataToEncode itself, which excludes the GS1 AI. Using IDAutomation's Tilde Method, a mod10 calculation is added to the end of the DataToEncode by using the ~m?? format, where ?? is the number of digits to base the calculation on, excluding AIs.
In this example, we will be appending the mod10 operator for 12 digits, since that is the length of the DataToEncode: ~m12
4. Combining steps 1 through 3 above, the result is the following: ~21201412345678912~m12
Creating the Barcode in Excel:
Make sure the following is performed before continuing:
1. Install the Code 128 Font.
2. Close and reopen all applications using the font so they may recognize the changes in the font cache.
3. Install and understand how to use the VBA Font Encoder in Excel.
Place the DataToEncode in the first column and in the next column use the Code128() function to create the barcode (with ApplyTilde enabled to recognize the GS1 encoding):
This gives us encoded text, which is what we expect:
We then apply an IDAutomation Code 128 Font (the 'M' font is used in this example at 12 points by convention):
The above produces a barcode which scans correctly:
The scan produces ]C1014123456789124, where ]C1 is the correct FNC1 and the 4 is the correct mod10 check digit.
Posted 2019 day(s) ago