Vba Generate Barcode Font

04.09.2019

(1) Barcode Font – UPC/EANFont Package (2) Font Encoder – Download the VBA (Also available in Step 1) A barcode font is a file that displays a barcode in text format. A font encoder is formula inside of an add-in, plug-in, or source code that performs a calculation to convert data into a format that the barcode font can understand. Microsoft Office Code 39 Barcode Tutorial. The Code 39 font is the easiest barcode symbology to use in Microsoft Office. Creating the barcode is as simple as appending the data with the start and stop characters of an asterisk (.) or exclamation point (!). The Native Code 39 Barcode Generator for Microsoft Excel provides barcoding capability to Microsoft Excel Spreadsheets with an embedded VBA macro making it. To distribute additional fonts or other components. This Barcode Generator for Excel version supports Code 39, which is also known as the 3 of 9 Barcode, Code 3 of 9 and Barcode-39.

  1. Generate Font Text

I would like to generate a 2d barcode (PDF417 or QR codes) in an Excel cell using macros. Just wondering is there any free alternatives to paid libraries to do this?

I know certain tools can do the job but it is relatively expensive to us.

Jeroen
38.1k26 gold badges137 silver badges220 bronze badges
user2306468user2306468

2 Answers

The VBA module barcode-vba-macro-only (mentioned by Sébastien Ferry in the comments) is a pure VBA 1D/2D code generator created by Jiri Gabriel under MIT License in 2013.

The code isn't completely simple to understand, but many comments have been translated from Czech to English in the version linked above.

To use it in a worksheet, just copy or import barcody.bas into your VBA in a module. In a worksheet, put in the function like this:

The usage is as follows:

Font
  1. Leave the CELL('SHEET) and CELL('ADDRESS') as they are since it'sjust giving reference to the worksheet and cell address you have theformula
    • A2 is the cell that you have your string to be encoded. In my case it's cell A2 You can pass 'Text' with quotes to do the same. Having the cell makes it more dynamic
    • 51 is the option for QR Code. Other options are 1=EAN8/13/UPCA/UPCE, 2=two of five interleaved, 3=Code39, 50=DataMatrix, 51=QRCode
      • 1 is for graphical mode. The barcode is drawn on a Shape object. 0 for font mode. I assume you need to have the font type installed.Not as useful.
      • 0 is the parameter for the particular barcode type. For QR_Code, 0=Low Error Correction, 1=Medium Error Correction, 2=Quartile errorcorrection, 3=high error correction.
      • 2 only applies to 1D codes. It's the buffer zones. I'm not certain what it does exactly but probably something to do with the1D bar spaces?

I added wrapper functions to make it a pure VBA function call rather than using it as a formula in a worksheet:

With this wrapper, you can now simply call to render QRCode by calling this in VBA:

Just input the worksheet name, cell location, and the QR_value. The QR shape will get drawn at the location you specified.

You can play around with this section of the code to change the size of the QR

Jonas Heidelberg
3,9441 gold badge21 silver badges36 bronze badges
PatratacusPatratacus

Generate Font Text

7561 gold badge6 silver badges17 bronze badges

I know this is quite an old and well-established post (though the very good existing answer has not been accepted yet), but I would like to share an alternative that I prepared for a similar post in StackOverflow in Portuguese using the free online API from QR Code Generator.

The code is the following:

It gets the job done by simply (re)creating an image from the URL built from the parameters in the cells. Naturally, the user must be connected to the Internet.

For example (the worksheet, with contents in Brazilian Portuguese, can be downloaded from 4Shared):

Community
Luiz VieiraLuiz Vieira

protected by CommunityMay 2 '16 at 12:38

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged excelvbafontsbarcode or ask your own question.

I'm trying to get Code 128 barcodes generated in Excel, through the use of VBA. I've found a VBA class that somebody made and shared via VBForums (subsequently modified to work with Excel VBA), but I'm having problems getting it to work.

If I use the code below in an Excel Macro-enabled spreadsheet, I get the #VALUE error when trying to use the Code128_Str() function on any input.

I lack the necessary skills to debug the code properly. If this script can be corrected, I think it would be immensely useful to many people trying to do the same. The script in question uses the free font to generate the relevant Code 128 output barcodes.

References:http://www.barcodeman.com/info/c128.php3 (Font Download)http://www.vbforums.com/printthread.php?t=514742&pp=40&page=1 (Original Forum Thread with Code)

shigzyshigzy

2 Answers

Here's how to use itYou need to have

  1. Module (To store the UDF function which you can call from Excelspreadsheet)
  2. Class Module (To store the class object)

ModuleWhere Class1 is the name of the Class Module

Class Module

Then in SpreadSheet, in any cell , you can call like=Code128_Str('TESTING')or=Code128_Str(A1)

LarryLarry
2,2682 gold badges18 silver badges34 bronze badges

Larry's code is brilliant, but I only found one small issue. (I would've commented on his answer but I don't have enough reputation points). I was having issues when I was encoding double zeros. For example '1200'. '00' translates to a space. There are numerous places in the code where it 'trims' spaces or it 'replaces' spaces. When I would try to encode '1200' the resulting bar code would only be '12'. To fix this I removed the applicable 'trims' and 'replaces' as follows. The code below is only the Class Module. Please refer to Larry's post for the Module code.

Class Module

Brad CBrad C

protected by CommunityJul 29 '13 at 7:16

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).
Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged excelvbacode128 or ask your own question.

Comments are closed.