Public Function Azalea_Code39withCheckDigit(ByVal Code39 As String) As String ' C39Tools 31dec06 jwhiting ' Copyright 2006 Azalea Software, Inc. All rights reserved. www.azalea.com ' Code 39 barcodes sometimes, though rarely, used with an optional mod 43 check digit. ' The input, Code39, is a string consisting of the 44-character version ' of Code 39 without the start and stop bars (*). ' AzaleaSoftware_Code39withCheckDigit is the original input plus the mod 43 check digit character, ' and the start & stop bars. Dim charSet As String ' mod 43 lookup table Dim i As Integer ' loop counter Dim subtotal As Integer ' check digit subtotal charSet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%" For i = 1 To Len(Code39) subtotal = InStr(charSet, Mid(Code39, i, 1)) - 1 + subtotal Next i ' concatenate the original string, Code39, and the check digit character AzaleaSoftware_Code39withCheckDigit = "*" + Code39 & Mid(charSet, (subtotal Mod 43 + 1), 1) + "*" ' The output, AzaleaSoftware_Code39withCheckDigit, is formatted using one of Azalea Software's Code 39 fonts. ' For example, B1=AzaleaSoftware_Code39withCheckDigit(A1) ' Or put another way, yourContainer.text=AzaleaSoftware_Code39withCheckDigit(yourInputString) End Function