Function AzaleaSoftware_EAN8(ByVal EAN As String) As String ' UPCTools 16may12 jwhiting ' Copyright 2012 Azalea Software, Inc. All rights reserved. www.azaleabarcodes.com ' The input, EAN, is a 7-digit string to be converted into an EAN-8 barcode. Dim checkDigitSubtotal As Integer ' reset-able throw-away variable Dim checkDigit As String ' check digit itself Dim i As Integer ' just a counter Dim temp As String ' placeholder ' do the check digit checkDigitSubtotal = 3 * (Val(Left(EAN, 1)) + Val(Mid(EAN, 3, 1)) + Val(Mid(EAN, 5, 1)) + Val(Right(EAN, 1))) checkDigitSubtotal = checkDigitSubtotal + Val(Mid(EAN, 2, 1)) + Val(Mid(EAN, 4, 1)) + Val(Mid(EAN, 6, 1)) checkDigit = Right(Str(300 - checkDigitSubtotal), 1) ' left guard bar temp = "|x" ' build the symbol using set A For i = 1 To 4 temp = temp + OddBar(Mid(EAN, i, 1)) Next 'I ' center guard bar & right half of symbol using set C (0-9), checkDigit & right guard bar AzaleaSoftware_EAN8 = temp + "y" + Mid(EAN, 5, 3) + checkDigit + "z" ' The output, AzaleaSoftware_EAN8, is formatted using one of Azalea Software's UPC fonts. ' For example, B1=AzaleaSoftware_EAN8(A1) ' Or put another way, yourContainer.text=AzaleaSoftware_EAN8(yourInputString) End Function Private Static Function OddBar(the) ' UPCTools 16may12 jwhiting ' Copyright 2012 Azalea Software, Inc. All rights reserved. www.azaleabarcodes.com OddBar = Chr(65 + (Val(the))) End Function