Link Search Menu Expand Document

VBScript (WSH)

The following example demonstrates how to use BarCode SDK as ActiveX with VBScript (.VBS) and generate barcode images using non-visual Barcode class in VBScript (.vbs files can be executed directly from Windows Explorer)

VISUAL BASIC 6 AND CLASSIC ASP SPECIAL NOTES: To use enumerations in VB6 or classic ASP you should use their integer values instead. To get integer value just check the documentation and you will see the integer value in the brackets. For example: (1) Code39.

Set bc = CreateObject("Bytescout.BarCode.Barcode")

' display information about Code39 symbology
msgbox "Encoding '012345' using Code39 symbology" & vbCRLF &  bc.GetValueRestrictions(0) ' 0 = Code39 symbology

' set symbology to Code39
bc.Symbology = 1 ' 1 = Code39 symbology type

' set barcode value to encode
bc.Value = "012345" 

msgbox "Saving Code39 barcode to 'Code39.png'"

bc.SaveImage "Code39.png"

msgbox "Encoding '012345' using Aztec symbology"

' set symbology to Aztec (2D)
bc.Symbology = 17 ' 17 = Aztec

' set barcode value to encode
bc.Value = "012345" 

' display information about Aztec symbology
msgbox "Encoding '012345' using Aztec  symbology" & vbCRLF & bc.GetValueRestrictions(17) ' 17 = Code39 symbology

bc.SaveImage "Aztec.png"

Set bc = Nothing