How to Generate an EAN Data Matrix / GS1 Data Matrix?

Set the Data Matrix format parameter to EAN ( enumeration eDMPr_UCCEAN). This inserts an FNC1 on the first position in the barcode and marks the barcode as GS1/EAN type.

Enable Escape Sequences

Use the sequence \F to encode an FNC1 separator character between variable length AIs.

How To Encode Hexadecimal Sequences as Binary Values?

TBarCode V8-V9

For encoding Hex values with TBarCode V9 you have to use "Escape Sequences" in the format "\xhh" (hh=Hex value). It is necessary to convert the hex sequence (e.g. from DP Premiumadress) into this format and turn on the TBarCode property "EscapeSequences". Below we provide VBA sample code for this conversion:

Distorted Barcode Output, Black Bar at the Top

If this occurs during printing, this effect is caused by the printer driver. Along other printer models this effect happens with Toshiba TEC and DataMax printers.

If this occurs during bitmap generation, this effect is caused by the screen driver.

The solution is to change the draw mode of TBarCode:

TBarCode V8+

Set the ActiveX Property DrawMode to Compatible.

TBarCode V7

Create a file barcode.ini with the following content:

[DRAW_MODE]
UseGDIRect=1

Copy the barcode.ini file to the installation directory of TBarCode (where you can find the file tbarcode7.ocx or tbarcode7.dll).

Restart the program.

How Can I Create Mail Merge Documents with Barcodes in Word?

TBarCode Office V10

Create a mail merge document with a data source. Insert a bar code into the document. Use the button "Insert Merge Field" to insert a mail merge field into the barcode.

TBarCode V9

For inserting multiple barcodes you can use the Serial Letter function in the TBarCode Word Toolbar. This function allows you to replace marked text with barcodes after the mail merge document was created. For more information about the TBarCode Toolbar and its functionality, please refer to the TBarCode OCX User Manual.

If you encounter speed problems you may alternatively use the Word Mail Merge Macro which can be downloaded in the TBarCode Download Area. The required steps for using the macro are explained in the enclosed text document.

Bar Codes in Microsoft Access

The common method to print bar codes from within Microsoft® Access™ is by using a report. The TBarCode Object need only be inserted once at the report definition. Therefore you need a table (query) which servers as data source for the report and a data field, that specifies the content of the bar code.

How to insert TBarCode OCX (as ActiveX Control) in a report?

Open a new report in design view. If you need a bar code for each record, then insert the ActiveX® Control into the detail area and position it at the desired place.

Thereto you choose Insert - ActiveX Control in the main menu. You will see a list of all available elements, from which you select TBarCode.

The control will be inserted in the detail area. The detail area will be printed once for each record set in the table (or query).

How to control the content of the bar code in a report?

In design mode right-click the TBarCode - ActiveX® Control. You will see a menu where you select Properties.

In the field Control Source located in the sub menu data you can define the content of the control. That means you can select the table or query field which is encoded as bar code.

Truncated Bar Codes in Microsoft Access

Depending on the printer driver the first bar in the symbol may be truncated (when printing through Microsoft Access). Also the symbol may be shifted inside of the bounding box.

If this occurs you can work around this problem by specifying an additional quiet zone around the bar code. This can be done in the property tab Appearance - Quietzone - Adjust.

If you have specified a module width, please make sure that the bounding box is large enough to display the bar code without clipping.

Barcodes in Crystal Reports

It isn't possible to add TBarCode directly into a report, but you can create a barcode image “on the fly” and load it to a Picture Box. Follow the instructions below to see how embedding of TBarCode into Crystal Reports 8 works.

Embedding via Picture Box (VB6 sample)

In a form (named “Form1”) embed a TBarCode Control (named “tbc”) and a Picture Box (named “TmpPicture1”). Then add the function code below to the form. It creates a bar code image „on the fly“ and uses the PictureBox as drawing surface.

In the Report event code (Format event) call the barcode generator function and assign the newly created barcode image to the Picture Box (named Picture1) in the report.

Private Sub Section3_Format(ByVal pFormattingInfo As Object)
'create the bar code for each record set
Dim data As String
data = Field1.Value
Set Me.Picture1.FormattedPicture =
Form1.BarcodeGenerate(data, Me.Picture1.Width, Me.Picture1.Height).Image
End Sub

Embedding via Bitmap File (VB6 sample)

In a form (named “Form1”) embed a TBarCode Control (named “TBarCode”) and adjust the bar code type and all other settings as desired. This bar code object will be used during report runtime for bar code creation “on the fly”.

In the Report event code (Format event) create a dynamic bar code image in a temp folder and load this image to the Picture Box (named pictBarCode) in the report.

If you don’t want to add a bar code control on the form you can create an instance of TBarCode also in memory and apply the settings programmatically.

VB Runtime Error '429': ActiveX component can't create object

You may get this runtime error if you didn't specify the full Prog-ID with CreateObject. Reference the TBarCode Type Lib in the project settings, and use the following commands to create a TBarCode object in VB (sample for TBarCode OCX V9):

Don't forget to include a reference to the type library of the ActiveX® Control in the menu Tools - References (otherwise enumerations cannot be used). We recommend to password protect your VBA code in the project property window.

How Can I Create an Optimal Bitmap (1D Code) for 812.8 dpi in VB6?

Approach 1

The first approach uses a pre-set (custom) module width, sets the DPI and then calculates the total width of the symbol. The principle works for other printers, too.

The OCX method BCWidthHdc2 can be used to calculate the width of the bar code. If a module width has been set, use a dummy value for the [in] nWidth. If you calculate the width in unit=mm, convert it to Pixels afterwards for the SaveImage function. There is a similar function for the height – but the height needs calculation only for 2D bar codes.

Note: When you set a module width of exactly 0.3125mms or 0.0123 inches you are 100% in the printing raster of a 812.8 dpi machine. This is one of the recommended values. If you have enabled the opt resolution flag, the module width is changed to the next (lower) pixel boundaries in the printing raster and therefore “optimized”. Dpi must be set accordingly for this optimization.

Approach 2

With the second, more simple approach, the module width is not set explicitly. Instead the scaling factor passed on to the GetOptimalBitmapSize (OCX API) function controls the module width. If you use it, don’t set a custom module width and/or optimal resolution in the API. The function performs some additional enlarging (based upon dpi), which should be turned off with DPI = 0 while calling the function.

Because we know the DPI of the printer we also know the pixel (printer dot) dimension. We also know that one module should be always an integer multiple of one printer dot. We have to consider that typically one module should not be smaller than 0.190mms at all (but depends on bar code type). Then all you need to do is to pass on the ScaleX = ModuleWidth/PixelSize factor (= 8, 9, 10,…) to the GetOptimalBitmapSize function and use the returned values for SaveImage.

Module width: The 0.0123 inch optimum are 10 Pixels at 812.8 dpi. So the scaling factor would be 10 for the GetOptimalBitmapSize function.

I Cannot Protect my Word Documents!

Solution: You have to leave design mode to be able to protect the document. If you insert a Barcode Control, the document is switched to design mode. Through the Control Toolbox you can leave design mode, then you are able to protect the document.

Printing Through VBA: Barcode Is Not Updated

You change the content of linked cells or the barcode control, then print directly from within VBA. But you see that the bar code controls still contain old values. The reason is that Excel does not send a redraw command to the ActiveX Controls before printing (if done from within VBA). This is a bug in Excel.

There is a workaround to force a redraw of the objects, you need to address each Barcode ActiveX Control programmatically in VBA and change its size before printing. Then it is redrawn by Excel.

How Can I Create a VCard Barcode?

VCard is not a bar code itself, it is a special file format, which can be used to store data in a bar code (e.g. into QR Code). A detailed description of the VCard format can be found here:
Wikipedia - VCard Specification

Just bring your data into the given format and you'll be able to read the barcode with your mobile phone and recognize the data as contact information.

Create VCard barcodes with Barcode Studio

With our Barcode Studio we offer an Assistant to create VCard barcodes the easy way.

How to Encode FNC1 (GS1 Barcodes)?

What's FNC1?

FNC1 is used as separator character for variable length data fields in the application identifier standard. It can be encoded with \F. Sample: The data field for the batch or lot number varies in length (up to 20 characters) and needs a termination (FNC1).

Please consider:

To encode FNC1 Escape-Sequences must be enabled.

Don't insert FNC1 after the last data field.

Insert FNC1 even if the maximum field length is used.

Example 1: FNC1 in TBarCode

In this example we generate a GS1-128 barcode with 2 Application Identifier. The batch or lot number (AI =10, variable length so it needs FNC1) and the best before date (AI=15).

Example 2: FNC1 in Barcode Studio

We use the same sample data like before. To add the functional character FNC1 to your barcode data follow the steps:

Enter the barcode data „10222333\F15100701“ .

Switch to the tab "Settings" and check Escape Sequences.

FNC1 will be insert and the Application Identifier (AI=15) is recognized automatically in the HRT.

In Barcode Studio 11.5+ you can use the new Assistant for GS1 Application Identifiers.

How can I Adjust the Default Barcode Type?

The default bar code type can be set through a file named barcode.ini.

The barcode.ini file must be located in the installation path of TBarCode and has to contain the following lines:

[DEFAULT_SETTINGS]
BarcodeType=8

The index (in this example 8) for the required barcode type can be found in the barcode reference, chapter 6.

How to Make TBarCode Control Visible in Word, Excel, Access (Windows x64)

If you have not installed the 64 Bit Office Version, Microsoft Word/Excel/Access are running in 32-Bit compatibility (WOW64) mode. They are no full 64-Bit applications, but they can be still operated under Windows 7 x64.

QR Code Character Set

SHIFT JIS / CP932 contains both of these character sets and is the Multi Byte character set used by TBarCode for QR-Code. For further information see Windows Codepage 932.

QR-Code 2005

The new ISO/IEC 18004:2006 standard for “QR-Code 2005” defines ISO-8859-1 (Latin-1) as default character set. So the “old” QR-Code uses Shift-JIS and the new QR-Code 2005 uses Latin-1 as default character set.

Encoding special Latin-1 characters

Encoding the full Latin-1 character set with QR-Code 1997/2000 can lead to problems – for details see Barcode Reference (section Encoding Special Latin-1 Characters).

I cannot encode Korean (or UTF-8) in a QR-Code

QR Code was developed in Japan by Denso (for Toyota) and uses ASCII + Japanese (Kanji) as default character set. So by default the bar code reader tries to decode data in a QR Code with the JIS X 0208 + JIS X 0201 character set. It does not look for UTF-8 or other character sets (except you use the ECI protocol but this is rarely supported by readers)!

Possible solutions:

A keyboard wedge bar code reader may be configured to use UTF-8. Otherwise it will always use the default JIS or Latin-1 character set. The ECI protocol would allow different character sets but the reader must support this protocol.

A serial bar code reader (attached to COM Port or Virtual COM Port driver through USB) transmits the data as sequence of Bytes. The data processing software can decode the data stream and decide how to decode it - as JIS, Latin-1, UTF-8 or as Korean MB character set.

If your bar code reader supports Korean (or you use a serial bar code reader) you also can try to set the TBarCode code page property to Korean instead of UTF-8.

Smartphone reader apps by default try to decode QR Codes with UTF-8. So chances are high that it works with a Smartphone reader and Codepage=UTF-8 adjusted in TBarCode.

Barcode Settings Lost After Reopening Document

Important note for Microsoft Office users: After performing the Microsoft security update from June 9, 2010 barcode objects embedded in Word and Excel documents (TBarCode OCX) may lose their settings:

Users of previous versions of TBarCode should update to TBarCode SDK V9.3.7 or alternatively to the upcoming version TBarCode SDK V10 (release in short, pre-release on request).

In case of update questions or for technical information please contact us.

VB Crashes When Reopening a Project With TBarCode OCX

When reopening a project with an embedded TBarCode element (on a form), Visual Basic crashes or shows an error message. This problem is caused by a problem in the Active Template Library (details here).

Use the following workaround (VB5, VB6) to solve this issue:

Insert the barcode control

Deactivate the control by adjusting the property (“Enabled” = False)

Save the project and open it – no crash

During runtime in the Form Load event set the Enabled property to True (programmatically)

Private Sub Form_Load()
TBarCode111.Enabled = True
End Sub

TEC-IT Datenverarbeitung GmbH

High quality software is what you are looking for - TEC-IT from Steyr (Austria) supplies this quality successfully.