+ Reply to Thread
Results 1 to 2 of 2

UDF for Data into 128 B barcode problem

  1. #1
    Safi
    Guest

    UDF for Data into 128 B barcode problem

    Function Format_Code128 (InString As String) As String
    Dim Sum As Integer, i As Integer
    Dim Checksum As Integer, Checkchar As Integer
    Dim MyString As String, CVal As Integer

    ' Initialize running total with value of
    ' Subset B start character

    Sum = 104

    ' Scan the string and add character value times position

    For i = 1 To Len(InString)

    ' Copy one character from InString position i to MyString

    MyString = Mid$(InString, i, 1)

    ' Get the numeric value of the character and subtract
    ' 32 to shift (the space character, ASCII value 32, has
    ' a numeric value of 0 as far as Code 128 is concerned)

    CVal = Asc(MyString) - 32

    ' Add the weighted value into the running sum

    Sum = Sum + (CVal * i)
    Next i

    ' Calculate the Modulo 103 checksum

    Checksum = Sum Mod 103

    ' Now convert this number to a character.

    If Checkdigit = 0 Then
    Checkchar = 174
    ElseIf Checkdigit < 94 Then
    Checkchar = Checkdigit + 32
    Else
    Checkchar = Checkdigit + 71
    End If

    ' Now format the final output string: start character,
    ' data, check character, and stop character

    MyString = Chr(162) + InString + Chr(Checkchar) + Chr(164)
    Format_Code128 = MyString
    End Function

    Hi,

    I have code above User Define funtion in Excel and converted my data
    (example CCF001257) into code 128 B of Barcode symbology..the UDF returns
    value as
    ¢CCF001257®¤ but when in change it into code 128 font with 20 font size the
    scanner does not reads it.. where is the problem lies ...

    Regards,

    safi.



  2. #2
    barcodewiz
    Guest

    Re: UDF for Data into 128 B barcode problem

    Safi,

    Make sure you are using the same Code 128 font that came with the
    function. Every font is different.

    Alek Szymanski
    http://www.barcodewiz.com


    Safi wrote:
    > Function Format_Code128 (InString As String) As String
    > Dim Sum As Integer, i As Integer
    > Dim Checksum As Integer, Checkchar As Integer
    > Dim MyString As String, CVal As Integer
    >
    > ' Initialize running total with value of
    > ' Subset B start character
    >
    > Sum =3D 104
    >
    > ' Scan the string and add character value times position
    >
    > For i =3D 1 To Len(InString)
    >
    > ' Copy one character from InString position i to MyString
    >
    > MyString =3D Mid$(InString, i, 1)
    >
    > ' Get the numeric value of the character and subtract
    > ' 32 to shift (the space character, ASCII value 32, has
    > ' a numeric value of 0 as far as Code 128 is concerned)
    >
    > CVal =3D Asc(MyString) - 32
    >
    > ' Add the weighted value into the running sum
    >
    > Sum =3D Sum + (CVal * i)
    > Next i
    >
    > ' Calculate the Modulo 103 checksum
    >
    > Checksum =3D Sum Mod 103
    >
    > ' Now convert this number to a character.
    >
    > If Checkdigit =3D 0 Then
    > Checkchar =3D 174
    > ElseIf Checkdigit < 94 Then
    > Checkchar =3D Checkdigit + 32
    > Else
    > Checkchar =3D Checkdigit + 71
    > End If
    >
    > ' Now format the final output string: start character,
    > ' data, check character, and stop character
    >
    > MyString =3D Chr(162) + InString + Chr(Checkchar) + Chr(164)
    > Format_Code128 =3D MyString
    > End Function
    >
    > Hi,
    >
    > I have code above User Define funtion in Excel and converted my data
    > (example CCF001257) into code 128 B of Barcode symbology..the UDF returns
    > value as
    > =A2CCF001257=AE=A4 but when in change it into code 128 font with 20 font =

    size the
    > scanner does not reads it.. where is the problem lies ...
    >=20
    > Regards,
    >=20
    > safi.



+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1