Function I25Encode(StringNumber) Dim asPattern(), sSTART, sSTOP Redim asPattern(10) sSTART = "NNNN" ' start and stop patterns can be found in fig. 3 sSTOP = "WNN" asPattern(0) = "NNWWN" ' these patterns can be found in fig. 1 asPattern(1) = "WNNNW" asPattern(2) = "NWNNW" asPattern(3) = "WWNNN" asPattern(4) = "NNWNW" asPattern(5) = "WNWNN" asPattern(6) = "NWWNN" asPattern(7) = "NNNWW" asPattern(8) = "WNNWN" asPattern(9) = "NWNWN" ' validate argument If (Len(StringNumber) Mod 2) <> 0 Then ' the number of characters in the argument must be odd I25Encode = "" Exit Function End If If Not IsNumeric(StringNumber) Then ' argument must be numeric I25Encode = "" Exit Function Else If (InStr(StringNumber, ".") <> 0) Or (InStr(StringNumber, ",") <> 0) Then ' argument is numeric but contains invalid characters to us I25Encode = "" Exit Function End If End If ' encode and interleave argument Dim sEncodedSTR, sUnit Dim iCharRead, sDigit1, sDigit2, i sEncodedSTR = "" For iCharRead = 1 To Len(StringNumber) Step 2 sDigit1 = asPattern( Asc( Mid( StringNumber, iCharRead, 1 ) ) - 48 ) sDigit2 = asPattern( Asc( Mid( StringNumber, iCharRead + 1, 1 ) ) - 48 ) sUnit = "" For i = 1 To 5 sUnit = sUnit & Mid( sDigit1, i, 1 ) & Mid( sDigit2, i, 1 ) Next sEncodedSTR = sEncodedSTR & sUnit Next I25Encode = sSTART & sEncodedSTR & sSTOP End Function