Printing bar codes in Microsoft Excel workbooks


This section assumes you have added the Visual Basic module to your workbook. See Importing our Visual Basic module in to a workbook.

Functions in the new module are used in Excel, just like existing Excel functions. For each type of bar code, there is a specific function and a specific font you should use in Excel.

Using bar code functions in formulas

Example: To print cell A1 as an automatic Code 128 bar code cell B1, do the following;

- In cell A1, enter some sample data. This will be the source data for the bar code. The source data can be a fixed value, or the result of a formula involving other cells;

  123456

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.

- In cell B1, we will use function CIA_CODE128( ) and cell reference A1. Enter the following formula;

  =CIA_CODE128(A1)

- Press enter the result appears automatically as 'strange' text characters in cell B1, like this;

  >l1l8[NY9]#

This is an example, your result may differ.

Note: The result of bar code functions only appears as a bar code, when you select the correct bar code font. 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.

Format cell, font and alignment

- Select the cell which contains the bar code function.

- Choose menu Format | Cells...

- Click the Font tab 

- Select the font and font size for the bar code function you are using. 

For example, if you are producing Code 128 bar codes, using function CIA_CODE128( ), you would select;

Font CIA Code 128 Medium
Size 14 points

If you are using a different bar code type, you will use a different function and you select a different font and font size.

On the Alignment tab select;

Vertical Top

Row height

Select the row which contains the bar code, choose menu Row | Height... and set the height so the complete bar code is displayed.

The cell now appears as an industry standard Code 128 bar code.

 


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