Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Public Function Bar128AB(BarTextIn As String, Subset As Integer) As String
' Initialize input and output strings
BarTextOut = ""
BarTextIn = RTrim(LTrim(BarTextIn))
' Set up for the subset we are in
If Subset = 0 Then
Sum = 103
StartChar = "{"
Else
Sum = 104
StartChar = "|"
End If
' Calculate the checksum, mod 103 and build output string
For II = 1 To Len(BarTextIn)
'Find the ASCII value of the current character
ThisChar = (Asc(Mid(BarTextIn, II, 1)))
'Calculate the bar code 128 value
If ThisChar < 127 Then
CharValue = ThisChar - 32
Else
CharValue = ThisChar - 103
End If
'add this value to sum for checksum work
Sum = Sum + (CharValue * II)
'Now work on output string, no spaces in TrueType fonts, quotes replaced for Word mailmerge bug
If Mid(BarTextIn, II, 1) = " " Then
BarTextOut = BarTextOut & Chr(228)
ElseIf Asc(Mid(BarTextIn, II, 1)) = 34 Then
BarTextOut = BarTextOut & Chr(226)
ElseIf Asc(Mid(BarTextIn, II, 1)) = 123 Then
BarTextOut = BarTextOut & Chr(194)
ElseIf Asc(Mid(BarTextIn, II, 1)) = 124 Then
BarTextOut = BarTextOut & Chr(195)
ElseIf Asc(Mid(BarTextIn, II, 1)) = 125 Then
BarTextOut = BarTextOut & Chr(196)
ElseIf Asc(Mid(BarTextIn, II, 1)) = 126 Then
BarTextOut = BarTextOut & Chr(197)
Else
BarTextOut = BarTextOut & Mid(BarTextIn, II, 1)
End If
Next II
' Find the remainder when Sum is divided by 103
CheckSumValue = (Sum Mod 103)
' Translate that value to an ASCII character
If CheckSumValue > 90 Then
CheckSum = Chr(CheckSumValue + 103)
ElseIf CheckSumValue > 0 Then
CheckSum = Chr(CheckSumValue + 32)
Else
CheckSum = Chr(228)
End If
'Build ouput string, trailing space is for Windows rasterization bug
BarTempOut = StartChar & BarTextOut & CheckSum & "~ "
'Return the string
Bar128AB = BarTempOut
End Function