Skip to content

tanty/barcode-vba-macro-only

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code
This branch is 12 commits ahead of JonasHeidelberg:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

1D and 2D Barcode generation VBA macro

VBA macro able to generate the 1D Code128, EAN, Interleaved 2 of 5 and Code39 barcodes, and the 2D Data Matrix and QR Code barcodes.

The macro is able to generate the barcodes as graphical objects or as text which will be shown as the proper barcode when the companion BarsAndSpaces.ttf font is applied to the text.

Usage

The syntax of the macro is as follows:

ENCODEBARCODE(sheetIndex; cellAddress; code; codeType; outputType; params; quietZoneWidth)
  • sheetIndex: index of the sheet in which the graphical object will be placed, in case of selecting that output type.
  • cellAddress: cell address in which the graphical object will be placed, in case of selecting that output type.
  • code: content to encode into the barcode.
  • codeType: barcode type to use. Possible values:
  • outputType: whether to generate a graphical object or just the text for which to apply the companion font. Possible values:
    • 0: use text.
    • 1: use a graphic object (default).
  • params: codeType specific parameters. See below.
  • quietZoneWidth: width of the 1D codes Quiet Zone. Default value: 2.

Example:

ENCODEBARCODE(CELL("SHEET"); CELL("ADDRESS"); A2; 1; 1; 0; 2)

Code128

params possible values:

  • 0: determine the code set to use automatically (default).
  • 1: start with code set A.
  • 2: start with code set B.
  • 3: start with code set C.

EAN

params possible values:

  • 0: automatically determine the subtype to use (default).
  • 1: use the EAN-13 subtype.
  • 2: use the EAN-8 subtype.
  • 3: use the UPC-A subtype.
  • 4: use the UPC-E subtype.
  • To add the check digit, increase the chosen subtype by 8. For example, a value of 9 means to use the EAN-13 subtype and add the check digit.

Interleaved 2 of 5

No additional parameters.

Code39

params possible values:

  • 0: automatically use the Full ASCII Code 39 mode.
  • 1: always use the Full ASCII Code 39 mode (default).
  • 2: don't use the Full ASCII Code 39 mode.
  • To add the Code 39 mod 43 check digit, increase the chosen mode by 4. For example, a value of 5 means to always use the Full ASCII Code 39 mode and add the check digit.

Data Matrix

params possible values:

  • 0: autodetect the encoding mode (ASCII, C40 and Text) (default).
  • 1: force ASCII encoding mode.

QR Code

params possible values:

Similar projects

About

Barcode generator for LibreOffice and MSOffice as pure VBA macro... with a critical bug fixed compared to the version on code.google.com

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • FreeBasic 100.0%