
How to Make CODE 128 in Microsoft Excel
Some examples how to make CODE 128 barcodes in Excel with StrokeScribe barcode generator without programming and fonts.
For VBA automation and bulk CODE 128 generation, look in the related tutorials.
Requirements
- Download and install the barcode generator
Placing a CODE 128 in Excel Using Active Document
The Active Document-based method is suitable if you need a single CODE 128 with manual data entry. This method does not require any programming, but it is less customizable.
1. Switch to the Insert tab on the Excel Ribbon and click Object.
2. Look for the StrokeScribe Document in the list of available objects:

3. Right-click the barcode object, select StrokeScribe Control->Properties from the context menu.
- Go to the General tab in the barcode properties dialog;
- Set Alphabet = CODE128;
- Type any text in the Text field.

CODE 128 Customization
Switch to the Code-specific 2 tab in the barcode properties dialog.

The CODE 128 generator supports the following properties:
- FontColor - controls the barcode color;
- TextBelow - a custom text label below the barcode;
- HBorderSize - the quiet zone size at the right and left of the barcode;
- VBorderPercent - the quiet zone size below and above the barcode.
Placing CODE 128 in Excel using ActiveX
The ActiveX-based barcodes allow automatic data syncing with a chosen worksheet cell. These barcodes are customizable from VBA or from the standard Excel's object property sheet.
1. Click Insert->More Controls on the Developer tab.
2. Select StrokeScribe Control from the list of available objects and press OK:

3. Click anywhere on the worksheet to insert the barcode object.
4. Activate the Design Mode and open the Properties window:

5. Use the property list to customize your barcode. To create a CODE 128, modify the following properties:

Linking the Barcode to a Cell
To automatically update the barcode when a cell content changes, use the linked cell technique.
CODE 128 Customization with VBA
1. Press Alt+F11 to open VBA window. Double-click the current worksheet name in the VBA project tree:

2. Paste the following code into the VBA editor:
Sub CreateCode128()
StrokeScribe1.Alphabet = CODE128
StrokeScribe1.Text = "Any text"
' Optional parameters:
StrokeScribe1.FontColor = RGB(0, 0, 255)
StrokeScribe1.Rotation = 90
StrokeScribe1.TextBelow = "CODE 128 in Excel"
End Sub
3. Place the caret into the CreateCode128() body, press F5 to run the code and switch back to the Excel window to enjoy the barcode.
To encode data from a cell, use the following code:
StrokeScribe1.Text = Range("A1")
To encode a byte array, use the following code:
StrokeScribe1.CodePage = -1
Dim b(1 To 3) As Byte
b(1) = &H1
b(2) = &H2
b(3) = &H3
StrokeScribe1.Text = b
Related Tutorials
To link CODE 128 to a cell or to use non-ActiveX bulk methods, see these tutorials: