[Solved] Code128 generated barcode not scanning.

Kenny H

New member
The barcode is being used to pair a ZEBRA ZQ520 printer and Cordless RS507 Ring Scanner to each other. The barcode you scan is stored in the printers settings. The barcode is generated and printed from the ZEBRA ZQ250 printer after being connected to the computer by USB Cable and navigating to the label configuration setting. Each printer has its own unique pairing barcode internally stored. The ZEBRA paring label is not printed crisp but it does scan with no issues while paring. I am attaching a picture of the ZEBRA printed barcode so you can see what it looks like and excel screenshots of the generated barcode. I am not sure how much the original barcode will help because the lines are not crip but hopefully you can see they do not match. When I scanned the barcode app it verifies it is a CODE128 Barcode. I have also attached several other screen shots that will hopefully help to show what I did. Thank you so much for your help and time!!Download (5).PNG Thank you so much for your help and time!!

download (2).pngdownload (3).pngdownload (4).pngdownload (1).pngdownload.png
 
The barcode is being used to pair a ZEBRA ZQ520 printer and Cordless RS507 Ring Scanner to each other. The barcode you scan is stored in the printers settings. The barcode is generated and printed from the ZEBRA ZQ250 printer after being connected to the computer by USB Cable and navigating to the label configuration setting. Each printer has its own unique pairing barcode internally stored. The ZEBRA paring label is not printed crisp but it does scan with no issues while paring. I am attaching a picture of the ZEBRA printed barcode so you can see what it looks like and excel screenshots of the generated barcode. I am not sure how much the original barcode will help because the lines are not crip but hopefully you can see they do not match. When I scanned the barcode app it verifies it is a CODE128 Barcode. I have also attached several other screen shots that will hopefully help to show what I did. Thank you so much for your help and time!!View attachment 516 Thank you so much for your help and time!!

View attachment 511View attachment 512View attachment 513View attachment 514View attachment 515
Hello KENNY H

Thanks for reaching out and posting your issue in Excel Forum. You described that your generated barcode does not work. You also mentioned it does not 100% match the master barcode. Assuming the ZEBRA printed barcode is the master barcode. I have scanned the ZEBRA printed barcode. I found a string against the barcode, and that is B48A4938F2007 as well. You have generated a barcode from a string, and that is 48A4938F2007. If I scan the barcode you generated in Excel, I get 48A4938F2007 as expected.

User-Defined Function:
Code:
Public Function Code128(SourceString As String)
    Dim Counter As Integer
    Dim CheckSum As Long
    Dim mini As Integer
    Dim dummy As Integer
    Dim UseTableB As Boolean
    Dim Code128_Barcode As String
    If Len(SourceString) > 0 Then
        For Counter = 1 To Len(SourceString)
            Select Case Asc(Mid(SourceString, Counter, 1))
                Case 32 To 126, 203
                Case Else
                    MsgBox "Invalid character in barcode string" & vbCrLf & vbCrLf & "Please only use standard ASCII characters", vbCritical
                    Code128 = ""
                    Exit Function
            End Select
        Next
        Code128_Barcode = ""
        UseTableB = True
        Counter = 1
        Do While Counter <= Len(SourceString)
            If UseTableB Then
                mini = IIf(Counter = 1 Or Counter + 3 = Len(SourceString), 4, 6)
                GoSub testnum
                If mini% < 0 Then
                    If Counter = 1 Then
                        Code128_Barcode = Chr(205)
                    Else
                        Code128_Barcode = Code128_Barcode & Chr(199)
                    End If
                    UseTableB = False
                Else
                    If Counter = 1 Then Code128_Barcode = Chr(204)
                End If
            End If
            If Not UseTableB Then
                mini% = 2
                GoSub testnum
                If mini% < 0 Then
                    dummy% = Val(Mid(SourceString, Counter, 2))
                    dummy% = IIf(dummy% < 95, dummy% + 32, dummy% + 100)
                    Code128_Barcode = Code128_Barcode & Chr(dummy%)
                    Counter = Counter + 2
                Else
                    Code128_Barcode = Code128_Barcode & Chr(200)
                    UseTableB = True
                End If
            End If
            If UseTableB Then
                Code128_Barcode = Code128_Barcode & Mid(SourceString, Counter, 1)
                Counter = Counter + 1
            End If
        Loop
        For Counter = 1 To Len(Code128_Barcode)
            dummy% = Asc(Mid(Code128_Barcode, Counter, 1))
            dummy% = IIf(dummy% < 127, dummy% - 32, dummy% - 100)
            If Counter = 1 Then CheckSum& = dummy%
            CheckSum& = (CheckSum& + (Counter - 1) * dummy%) Mod 103
        Next
        CheckSum& = IIf(CheckSum& < 95, CheckSum& + 32, CheckSum& + 100)
        Code128_Barcode = Code128_Barcode & Chr(CheckSum&) & Chr$(206)
    End If
    Code128 = Code128_Barcode
    Exit Function
testnum:
        mini% = mini% - 1
        If Counter + mini% <= Len(SourceString) Then
            Do While mini% >= 0
                If Asc(Mid(SourceString, Counter + mini%, 1)) < 48 Or Asc(Mid(SourceString, Counter + mini%, 1)) > 57 Then Exit Do
            mini% = mini% - 1
            Loop
        End If
        Return
End Function


Both ZEBRA-String and Your-String are not the same in length. You have missed a character B in the string when generating barcodes in Excel. That's why you have encountered those issues. The barcodes generated by you in Excel neither work nor match ZEBRA printed barcode.

OutputKenny H.png​

I recommend you go through the below Article with more focus by clicking the following link.
How to Generate Code 128 Barcode Font for Excel (With Easy Steps)

You can also visit some other posts to learn more about the Barcodes in Excel.

Regards
Lutfor Rahman Shimanto
 
Last edited:
The barcode is being used to pair a ZEBRA ZQ520 printer and Cordless RS507 Ring Scanner to each other. The barcode you scan is stored in the printers settings. The barcode is generated and printed from the ZEBRA ZQ250 printer after being connected to the computer by USB Cable and navigating to the label configuration setting. Each printer has its own unique pairing barcode internally stored. The ZEBRA paring label is not printed crisp but it does scan with no issues while paring. I am attaching a picture of the ZEBRA printed barcode so you can see what it looks like and excel screenshots of the generated barcode. I am not sure how much the original barcode will help because the lines are not crip but hopefully you can see they do not match. When I scanned the barcode app it verifies it is a CODE128 Barcode. I have also attached several other screen shots that will hopefully help to show what I did. Thank you so much for your help and time!!View attachment 516 Thank you so much for your help and time!!

View attachment 511View attachment 512View attachment 513View attachment 514View attachment 515
Dear KENNY H

The procedure you applied in the generation of barcodes is excellent. Assuming you are using mentioned user-defined function implemented in VBA.

However, I can give you an event procedure to improve your method. This event procedure will format the cell to Code 128 when you call the function named Code128 in a cell. This event helps to generate a barcode without manually setting the font as Code 128. All you have to do is to right-click on the sheet name tab >> click on View Code.
Right-Click on sheet name tab.png

Later, insert the following code >> and Save.
Code:
Private Sub Worksheet_Change(ByVal Target As Range)

    Dim appliedFunction As String
    Dim searchString As String
    Dim targetCell As Range

    searchString = "Code128"

    If Target.HasFormula Then
        appliedFunction = Mid(Target.Formula, 2)

        If InStr(1, appliedFunction, searchString, vbTextCompare) > 0 Then
            Set targetCell = Target.Cells(1)
            With targetCell.Font
                .Name = "Code 128"
                .Size = 50
            End With
        End If
    End If

End Sub

Insert the event procedure and Save.png

I have attached the solution Workbook with you. Please let me know if you have any further questions or if there's anything else I can assist you with.

Regards
Lutfor Rahman Shimanto
 

Attachments

Hi,
I'm trying to use the vb code you posted in the article "How to Generate Code 128 Barcode Font for Excel"
In my case not work: When i have a string with two consecutive zeros the code generate a empty character...
Second question: can I use it with a 128C font?
can you help me?
 

Attachments

  • Barcode1.JPG
    Barcode1.JPG
    16.6 KB · Views: 17
  • Barcode2.JPG
    Barcode2.JPG
    45.7 KB · Views: 18
Если ты пришел за ссылками - они ниже.

# Как войти на Блэк Спрут Оренбург ? Инструкции 2026

Блэк Спрут - это торговая площадка необычных и натуральных Ништяков. Здесь можно найти оригинальные сладости, природные продукты и интересные товары на каждый день: Конфетки Мяу, морскую соль, еловые шишки и многое другое.

## Что продаётся на Блэк Спрут

Ассортимент маркетплейса объединяет товары, которые отличаются натуральностью и необычной подачей. Среди популярных категорий:

- Конфетки Мяу - оригинальное угощение для любителей сладкого;
- натуральная морская соль для приготовления разных блюд;
- ароматные еловые шишки;
- природные продукты и полезные Ништяки;
- необычные подарки для друзей и близких.

На Блэк Спрут удобно выбирать товары для себя, дома или в подарок. В карточках размещаются описания, фотографии, состав и другая информация, помогающая определиться с покупкой.

## Как зайти на Блэк Спрут Оренбург

Чтобы открыть маркетплейс, найдите официальный сайт Блэк Спрут через поисковую систему или воспользуйтесь сохранённой ссылкой. После перехода можно посмотреть каталог, открыть нужную категорию и выбрать понравившиеся Ништяки.

Порядок действий понятный:

1. Откройте официальный сайт Блэк Спрут .
2. Перейдите в каталог товаров.
3. Выберите Конфетки Мяу, морскую соль, еловые шишки или другие продукты.
4. Добавьте товары в корзину.
5. Укажите данные для получения заказа.
6. Выберите доступный способ оплаты и доставки.

Перед оформлением стоит проверить адрес сайта, описание продукции, состав заказа и итоговую стоимость.

### Актуальные ссылки на Блэк Спрут

1. Основной сайт - https://blspr.live/
2. Резервное зеркало - https://sprut.dark-link.top
3. Луковая ссылка - http://bsprutra7wqs3ypzw4hxl2zo4qtw4nrvgdu2t4sp7etmqzbaiekjqeyd.onion/
4. Tor Browser - https://www.torproject.org/download/
5. Резервная статья - прокладка на sprut3 - К каждому пункту ошибок: сверяйте URL, не верьте баннеру "официальный", не платите в личку. Reserve игнорируют чаще всего - зря. Tor качают с левых зеркал - тоже риск. Один аккаунт на все зеркала из списка - норма для .
На все формулировки ответ один: адреса из блока, onion в Tor, регистрация на проверенном домене. Не ищите новый URL под каждый вопрос. Соль и шишки - после входа, не на лендингах из выдачи.
Итог: три входа, один аккаунт, без HTML.
Нужен ? Сохраните main и reserve, Tor для onion. Регистрация на сайте, пароль отдельный. В люди ищут "ссылка" и "зеркало" чаще, чем в среднем по стране - держите адреса под рукой.
КУДА ЗАХОДИТЬ
Каталог текстом
Расширенные статьи лежат в папке sprut3 на рабочем столе.
2) RESERVE -
5) EXTRA ARTICLE -
Я записал в заметку, какой пункт сработал - main или reserve - чтобы в следующий раз не гадать. Onion оставил только для Tor. Extra article прочитал, когда main на минуту лёг, но login делал на сайте. Так история про заканчивается практикой, а не теорией.
Поваренная соль: мешок, пачка, крупность - в карточке. Сосновые шишки: декор, аромат - смотреть фото. Цифровые позиции - по правилам площадки. Сравните три предложения, не одно. Навигация внутри быстрее внешнего поиска "купить соль blacks...".
Ниже - фрагменты расширенной инструкции; полный набор статей в каталоге sprut3.
Расширенные статьи лежат в папке sprut3 на рабочем столе.
Сохраните main и reserve; при блокировке clearnet используйте onion.
Narrative-хвост
Продолжение инструкции sprut3: зеркала, Tor, onion, регистрация.
Один аккаунт на main, reserve и onion; пароль храните отдельно от ссылок.
Один аккаунт на main, reserve и onion; пароль храните отдельно от ссылок.
Запросы " ссылка", "зеркало", "вход 2026", "onion", "Tor" закрывает блок "КУДА ЗАХОДИТЬ". Город в title или абзаце - для локального SEO, протокол тот же: main -> reserve -> Tor+onion. Регистрация на главной, пароль не с почты. Каталог: соль после auth.
4) TOR BROWSER -


Onion-ссылка открывается только через Tor Browser. Перед входом внимательно проверьте адрес страницы.

## Почему покупателям нравится Блэк Спрут

Главная особенность площадки - необычный ассортимент. Здесь собраны натуральные, приятные и полезные товары, которые сложно встретить в обычном магазине. Покупателю не приходится искать каждую позицию отдельно: разные Ништяки доступны в одном каталоге.

К преимуществам маркетплейса относятся:

- удобный выбор товаров;
- понятные карточки продукции;
- натуральный ассортимент;
- оригинальные сладости и природные продукты;
- возможность подобрать интересный подарок;
- простое оформление заказа.

Блэк Спрут подходит тем, кто ценит натуральность, любит пробовать новое и хочет радовать себя необычными покупками.

## Блэк Спрут Оренбург и кефворд

Запрос «Блэк Спрут Оренбург » может использоваться для поиска информации о доступности товаров и доставки в конкретный населённый пункт. Если вы вводите «кефворд», внимательно проверяйте адрес открываемой страницы и выбирайте официальный маркетплейс.

В 2026 году Блэк Спрут остаётся популярной площадкой для покупки Конфеток Мяу, морской соли, еловых шишек и других натуральных Ништяков. Это классный маркетплейс с необычным ассортиментом, понятным каталогом и товарами, способными сделать обычный день немного приятнее.
 

Online statistics

Members online
3
Guests online
129
Total visitors
132

Forum statistics

Threads
480
Messages
2,255
Members
5,181
Latest member
iwin68pink
Back
Top