Public Function Azalea_Interleaved2of5(ByVal I2of5 As String) As String ' I2of5Tools 03jan07 jwhiting ' Copyright 2007 Azalea Software, Inc. All rights reserved. www.azalea.com ' The input, I2of5, is a string to be converted into an Interleaved 2 of 5 barcode. ' Azalea's Interleaved 2 of 5 fonts map each pair of input numbers into one character. Dim i As Integer Dim temp As String Dim chunk As String ' placeholder If Len(I2of5) Mod 2 <> 0 Then ' if the input has odd number of digits I2of5 = "0" + I2of5 ' pad it with a leading zero End If For i = 1 To Len(I2of5) step 2 chunk = mid(I2of5, i, 2) ' grab 2 characters If Val(chunk) < 90 Then ' offset into fonts' character set temp = temp + Chr(Val(chunk) + 33) ElseIf Val(chunk) = 90 Then temp = temp + Chr(182) ElseIf Val(chunk) = 91 Then temp = temp + Chr(183) ElseIf Val(chunk) > 91 Then temp = temp + Chr(Val(chunk) + 104) End If Next i ' Add the start and stop bars (ASCII 171 & ASCII 172) before and after the input string. AzaleaSoftware_Interleaved2of5 = Chr(171) + temp + Chr(172) ' The output, AzaleaSoftware_Interleaved2of5, is formatted using one of Azalea Software's Interleaved 2 of 5 fonts. ' For example, B1=AzaleaSoftware_Interleaved2of5(A1) ' Or put another way, yourContainer.text=AzaleaSoftware_Interleaved2of5(yourInputString) End Function