Printing bar codes in Microsoft Word documents

This section assumes you have added the Visual Basic module to your document, or document template. See Import our Visual Basic module in to a template or document.

Functions in the new module can be used in Word, just like existing Visual Basic functions. For each type of bar code, there is a specific function to use to return the bar code, and a specific font to select, to print the bar code.

Step by step

If you are adding bar codes to an existing document, goto Step 2.

1. Create your document or document template in the usual way.

In Word, you should first design your document template in the usual way. Create everything you need in your document, except bar codes.

2. When you have created your document or document template, then you can add bar codes.

Bar codes are typically printed using word fields, such as {DOCPROPERTY} fields, or {MERGEFIELD} fields.

The sections below show how to use {DOCPROPERTY} fields to store one or more bar codes in a document, or to use {MERGEFIELD} fields to print many bar codes from a data document using Mail Merge.

Note: If you need a specific example, for your application please email help@ciax.com

{DOCPROPERTY}

JIT-DOC includes an example template that uses document properties to store, display and print bar codes using a {DOCPROPERTY} field.

- Open document template Barcode.dot and print it.

Note: The template is a self contained example - it should be self explanatory. If you read the template and examine the small amount of Visual Basic code, you can see how it works, and you can copy the way it works.

Background information

Bar code functions produce text strings. Text strings can be stored in Word documents in custom document properties.

Document properties can be displayed in documents using {DOCPROPERTY} fields.

{DOCPROPERTY "BarcodeProperty" \* CHARFORMAT}

Therefore, a pre-calculated bar code can be stored in Word documents (as a property) and you can automatically print the bar code in the document using {DOCPROPERTY} field, and a bar code font.

Bar code fonts must be installed to print bar codes. A license is required for each person that prints the bar codes because JIT-DOC fonts will be used. A license is also required to create bar codes, using components in JIT-DOC.

{MERGEFIELD}

You can use bar code functions to calculate bar codes for all of the records (rows) in a table, in a Word data document.

After all of the bar codes have been calculated, you can use Mail Merge in the usual way to print your data fields, and the new bar code fields.

{MERGEFIELD "FieldName" \* CHARFORMAT}

Note: For each type of bar code, there is a specific function to use. For Code 128 the function is CIA_CODE128( ).

See: Bar code functions.

Selecting a bar code font

Note: For each bar code function, there is a font and font size to use. 

See: Bar code font name and font size to use to discover the font and font size to select.

The result of bar code functions only appears as a bar code, when you select the correct bar code font and you print or print preview the document.

 

 


Copyright 2000 CIA (BAR CODES) UK. All rights reserved. Reproduction prohibited.