Code Bar VB6 tutorial shows how to generate barcodes in Visual Basic 6 using Barcode Generator SDK. Use the source code below for barcode generation.
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" Set bc = Nothing
The output of the above program is as below:
In order to use Bytescout barcode generation with VBScript, make sure you have “ActiveX” components installed. These components can be installed from the ByteScout SDK installation path. For example, in my machine, these SDKs are installed at “C:\Program Files\Bytescout BarCode Generator SDK“. In order to install ActiveX components, simply navigate to the “ActiveX” folder inside, and click on the “InstallAsActiveX.bat” file.
Set bc = CreateObject("Bytescout.BarCode.Barcode")
We are creating a barcode generator instance and saving it in a variable named “bc“. We are using this code for demo purposes hence not passing any registration name and key, which will have a watermark in the generated output. In production, we should configure the registration name and key. We can do this by setting the properties “RegistrationName” and “RegistrationKey” like the following.
bc.RegistrationName = "demo" bc.RegistrationKey = "demo"
bc.Symbology = 1 ' 1 = Code39 symbology type
We can provide barcode value by setting the “Value” property.
bc.Value = "012345"
Barcode output can be obtained by setting the output file name to “SaveImage” method.
This is how easy to use ByteScout Barcode Generation SDK to generate barcodes with VBScript.
Thank you for reading!