Inserting Barcodes into Microsoft Word Documents

To insert a bar code into a Microsoft Word document follow these steps:

  1. Switch to the Add-Ins tab.
  2. Open the TBarCode Panel.
  3. Select the barcode type (e.g. Code 128, QR code...).
  4. Enter your barcode data.
  5. Adjust the size of the barcode (width, height, module width etc).
  6. Click the button Insert Barcode. Finished!
Insert Barcodes into Microsoft Word with TBarCode Office
Barcodes in Word Mail Merge

Inserting Barcodes into Serial Letters

Mail merge fields (e.g. the customer number) can be selected directly and then printed as barcode:

Use the button Insert Field... to encode the required merge fields in the bar code.

A demo of our serial letter functionality you will find in our TBarCode Office Video.

Video: Barcodes in Word Documents and Serial Letters

Barcode Word Add-In: Create Barcodes in Word

The first part of the video demonstrates how to insert bar codes into Microsoft Word. The second part of the video shows how to generate bar codes in a Word mail merge / serial letter using a recipient list.

For more videos visit our TBarCode Office Tutorial Channel!

How To Create a Swiss QR Code

Swiss QR Code is available in TBarCode Office V11 - follow the link and download the new version.

Below we give you instructions on how to create Swiss QR Code 2.2 in a serial letter:

  1. Download the Excel Sheet for Swiss QR Bills (click the link). The sheet contains calculated columns, which create the data format for the Swiss QR Code 2.2 payment standard.
  2. Enter the payment information into columns A - Q.
    Note the calculated columns SwissQRCode_Part1, SwissQRCode_Part2 and SwissQRCode_Part3, which will contain the bar code data for the bar code add-in. There are also more calculated columns at the right, which are used to validate your input. Line Feeds are encoded through the \n escape sequence.
  3. In your Word mail merge document, select the Excel sheet as data source for the mail merge.
  4. Open TBarCode Panel, select Swiss QR Code and add the serial field placeholders via Insert Fields as shown below:
    Swiss QR Code Serial Fields
    We split the data content into multiple fields, because in the serial letter you are limited to 255 characters in a single field. In the barcode this will be put back together correctly. The field SwissQRCode_Part3 is required if further data is coded after the EPD (Bill-Info, AV Parameter 1, AV Parameter 2).
TBarCode Office is the perfect solution for serial letters. If you only need to create a few Swiss QR Codes per year, you may create them also with our Swiss QR Bill Online Generator.

How To Create a Barcode Using the vCard Format

To create a vCard bar-code for business cards you have to enter the data using the correct data format. Below you can find some samples using the appropriate data structure.

vCard Data Structure:

BEGIN:VCARD
N:Doe;John
TEL:+43 7252 72720
EMAIL:support@tec-it.com
URL:http://www.tec-it.com
ADR:;;Wagnerstrasse 6;Steyr;;4400;Austria
END:VCARD

vCard structure using mail merge data fields:

BEGIN:VCARD
N: «lastname»;«firstname»
TEL: «phone»
EMAIL: «email»
URL: «url»
ADR:;; «address»;«city»;;«zip»;«country»
END:VCARD

Here is a Word Barcode-Add-In screenshot with such merge fields:

TBarCode Office with vCard settings

About choosing the correct QR code settings: You can use one of the vCard templates (small, medium, large) included in TBarCode Office.

vCard 3.0 Excel Sheet

Below we give you instructions on how to create a serial letter with our vCard 3.0 Excel sheet.

  1. Download the Excel Sheet for vCard 3.0 (click the link). The sheet contains a calculated column that creates the data format for the vCard 3.0 standard.
  2. Enter the contact information into columns A - O.
    Note the calculated column vCard V3.0, which will contain the bar code data for the bar code add-in. Line Feeds are encoded through the \x0A escape sequence.
  3. In your Word mail merge document, select the Excel sheet as data source for the mail merge.
  4. In the TBarCode Panel click the Templates icon and select vCard 3.0 Medium template. This loads the required QR code settings into the panel.
  5. Add the serial field placeholder via Insert Fields. Note that in serial letters you are limited to 255 characters in a single field (for workarounds please contact our support).

Mail Merge Errors

Mail Merge Stops After Two Records with TXT or CSV Datasource

Solution: The data-file for the mail merge must be connected as "OLE DB Datasource".

Connect your data-file with Select Recipients and select your text or CSV file. In the Confirm Data Source dialog, select "OLE DB Database Files" and click OK.

If the Confirm Data Source dialog does not appear you have to enable it in the Word Options. Go to Word Options | Advanced | General and activate the option "Confirm file format conversion on open". Then reconnect your data as described above (without attaching the data source again, the option may not be applied).

TBarCode Office with Word - Word Options

Fatal Error at MailMergeDataField.get_Value()

Access MDB Data Source: Please verify the table fields in your data source. The error can appear if a field name contains more than 32 characters. As a solution rename the fields in your import table or create a view with renamed fields.

Wrong Page Numbers in the Barcode

If your mail merge bar code references fields or document properties containing page numbers, wrong values can be read.

The behavior is caused by the internal update order in Word. It may occur that the bar code is created/drawn before the page numbers have been calculated (and an old value is read). Unfortunately we have no influence on this problem.

Barcode Data Doesn't Change When Using Mail Merge

The same barcode data is inserted when creating mail merge barcodes. To workaround this problem, try one of the following steps:

Preview Mode

  • In the preview mode the barcode is always shown using the data from the first record.
  • To get the correct barcodes please do a mail merge into a new document or directly to the printer.

Layout Options

  • The barcode must be insert in the layout options (Format Object) always as „In line with text“ („In Front of Text“ is partially supported since V10.8).
  • If you use other wrapping styles, the bar code is not recognized in a mail merge.
  • For flexible bar code positioning you can insert the barcode into a freely positioned text box or table.

Scaled or Cropped EMF Barcodes with Remote Desktop

Problem

If you connect to a PC through Remote Desktop, the EMF barcodes may look scaled or cropped after updating the bar codes. The problem occurs if you have scaled the size of text, apps and other items, that means the scaling in the Display Settings is set to 125% or higher.

Text or App Size Is Set to 125%
Example for a scaled size, which triggers the problem.

Workaround

In order to fix the EMF bar code scaling, enable the following setting in Windows 10:

  • Right click on the desktop and select Display Settings.
    Alternatively open the Settings app, go to the System group of settings, then select the Display tab.
  • Scroll down to the Scale and layout section and click Advanced scaling settings.
  • On the following screen, below “Fix scaling for apps”, enable the Let Windows try to fix apps so they are not blurry switch:

Fix Scaling for Apps

After that restart Excel (or Word) and refresh the bar codes in your document: Press SHIFT + Refresh in the add-in panel to force a refresh of all bar codes.

No Barcode Visible / Cropped Barcode

TBarCode is inserted in Word as „Inline Shape“. In case of Inline Shapes, the shape is clipped if the line height is configured to a fixed value.

The barcode should be visible again if you adjust line spacing to "Single".

Barcode Control Blocked or Barcode Not Updated

Please verify your security settings.

Network Path

By default documents from a shared network path containing active content (such as barcode controls) are opened in a safe mode, where active content may be disabled. If you see a yellow security warning on top of your document, go to the trust center in Word and/or Excel and allow the network path you use.

Security Alerts

TBarCode Office V10 is using ActiveX Controls for bar code creation. Depending on your security settings, ActiveX Controls may be blocked. If you see a yellow security warning on top of your document, you have to click "Enable Content" to allow access to the Barcode ActiveX Controls. The behavior of ActiveX Contols can be adjusted as shown below:

Barcode Shows "Adjust Properties" (V10)

The following information applies to Version 10 in case Barcode ActiveX Controls are embedded. The problem does not occur with EMF pictures.

Lost Settings After Saving the Document

Barcodes in a table can lose their settings when the document is saved. It seems the embedded Barcode ActiveX Controls are reset due to a Word bug. Customer reports show that the problem occurs in Word 2013 – but not with the latest service pack (15.0.4903.1002 or later).

Another reason for this problem can be that the document is opened and saved on a system where TBarCode/Office is not installed.

Solution

The solution is to update Office to the latest service pack or to re-install Office with the latest version. Make sure you edit the document always on a system where the add-in is installed and working properly.

How to: Use Microsoft Word Programmatically with IIS Applications

In order to make the Add-In work properly you need the following IIS application settings

  • Enable impersonation in the web.config file.
  • Configure the Anonymous Authentication Identity and change it to a specific user.
  • License the Add-In under the specified user account or ask for a user-independent license import (sales@tec-it.com).
Use of the Add-In is only permitted in Intranet applications (according to the terms of the site or enterprise license).

How Can I Verify if the Add-in Has Been Loaded?

You can use the following VBA code to verify if the add-in is available (loaded). You can show a warning (at startup or when clicking a button) if the add-in is missing.

Public Function IsTBarCodeWordAddInActive() As Boolean
Dim objAddIn As COMAddIn
IsTBarCodeWordAddInActive = False
For Each objAddIn In Word.Application.COMAddIns
  If objAddIn.ProgID = "TECIT.TBarCode.WordAddIn" And InStr(objAddIn.Description, "11") Then
    If objAddIn.Connect = True Then
      IsTBarCodeWordAddInActive = True
    End If
  End If
Next
End Function

How to check if available:

If IsTBarCodeWordAddInActive() Then
  MsgBox "All OK :-)"
Else
  MsgBox "TBarCode Word Add-In (V11) is missing!"
End If

The Panel Does Not Show/Recognize the Selected Barcode

In order for the panel to read the freely positioned barcode correctly, the text wrapping style must be set to „In Line With Text". Click here for more information.

For serial letters there is a preliminary, experimental support for freely positioned objects (so that in mail merge the barcode should be updated). But for editing the barcode in the panel, you must always switch to „In Line With Text".