Excel VBA Macro
Here’s some example code that you can use in an Excel VBA macro…
Before you begin, make sure you have downloaded and installed the barcode reader sdk for windows, and run REGISTER.BAT as administrator in the bin folder.
Set Barcode = CreateObject("SoftekBarcodeCOM.Barcode") ' Set the license key here Barcode.LicenseKey = "MY LICENSE KEY" Barcode.ScanDirection = 15 ' Select the barcode type to search for Barcode.ReadCode128 = True Barcode.ReadCode25 = True Barcode.ReadEAN13 = True Barcode.ReadEAN8 = True Barcode.ReadUPCA = True Barcode.ReadUPCE = True Barcode.ReadCode39 = True FILE_NAME = "C:\PATH\TO\MY\IMAGE.TIF" Barcode.ScanBarCode (FILE_NAME) nBarCode = Barcode.BarCodeCount If (nBarCode <= -6) Then 'Evaluation expired or is not valid MsgBox ("License error") ElseIf (nBarCode < 0) Then MsgBox ("Error reading barcode") ElseIf (nBarCode = 0) Then MsgBox ("No barcode found") Else strBarcode = Barcode.barstring(1) End If
You’ll need to modify the FILE_NAME to some file on your system and do something withthe strBarcode result, but this should get you up and working.