ByteScout Barcode Reader SDK - VBScript - Read Code 39 To Excel - ByteScout

ByteScout Barcode Reader SDK – VBScript – Read Code 39 To Excel

  • Home
  • /
  • Articles
  • /
  • ByteScout Barcode Reader SDK – VBScript – Read Code 39 To Excel

How to read code 39 to excel in VBScript using ByteScout BarCode Reader SDK

How to read code 39 to excel in VBScript

Read code 39 to excel is easy to implement in VBScript if you use these source codes below. ByteScout BarCode Reader SDK: the SDK for barcode decoding. Can read all popular types from Code 128, GS1, UPC and Code 39 to QR Code, Datamatrix, PDF417. Images, pdf, TIF images and live web camera are supported as input. Designed to handle documents with noise and defects. Includes optional splitter and merger for pdf and tiff based on barcodes. Batch mode is optimized for high performance with multiple threads. Decoded values can be exported to XML, JSON, CSV or into custom data format. It can read code 39 to excel in VBScript.

This code snippet below for ByteScout BarCode Reader SDK works best when you need to quickly read code 39 to excel in your VBScript application. This VBScript sample code is all you need for your app. Just copy and paste the code, add references (if needs to) and you are all set! Test VBScript sample code examples whether they respond your needs and requirements for the project.

Free trial version of ByteScout BarCode Reader SDK is available on our website. Documentation and source code samples are included.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)

Code39BarcodeToExcel.vbs
      
if WScript.Arguments.Count < 1 Then MsgBox "Run with the folder path as the argument" & vbCRLF & vbCRLF & "Code39BarcodeToExcel.vbs <InputFolder>" WScript.Quit 0 End If Set objFSO = CreateObject("Scripting.FileSystemObject") ' define allowed input images extensions inputImagesExtensions = "JPG,JPEG,PNG,BMP,PDF,TIF" Set reader = CreateObject("Bytescout.BarCodeReader.Reader") ' Set Code39 barcode types for searching reader.BarcodeTypesToFind.Code39 = True ' Set excel document Set document = CreateObject("Bytescout.Spreadsheet.Spreadsheet") ' Set document keys document.RegistrationName = "demo" document.RegistrationKey = "demo" ' Add new worksheet Set worksheet = document.Workbook.Worksheets.Add("Code39") ' Set cell index value Dim CellIndex CellIndex = 0 ' Set Initial Value CellIndex = (CellIndex + 1) Set cell_value = worksheet.Cell_2("A" + Cstr(CellIndex)) Set cell_filename = worksheet.Cell_2("B" + Cstr(CellIndex)) cell_value.Value = "Barcode Value" cell_filename.Value = "File Name" Set objInputFolder = objFSO.GetFolder(WScript.Arguments(0)) Call ProcessFolder(objInputFolder) ' delete output file if exists already Set fso = CreateObject("Scripting.FileSystemObject") If (fso.FileExists("output.xls")) Then fso.DeleteFile("output.xls") Set fso = nothing ' save document document.SaveAs "output.xls" WScript.Echo "successfully created 'output.xls' file!" ' close Spreadsheet Set document = Nothing WScript.Quit 0 Sub ProcessFolder(folder) Set objFolder = objFSO.GetFolder(folder.Path) Set colFiles = objFolder.Files For Each objFile in colFiles ' Check the file type If inStr(inputImagesExtensions, UCase(objFSO.GetExtensionName(objFile.Name))) > 0 Then reader.ReadFromFile objFile.Path For i = 0 To reader.FoundCount - 1 ' Get cell value CellIndex = (CellIndex + 1) Set cell_value = worksheet.Cell_2("A" + Cstr(CellIndex)) Set cell_filename = worksheet.Cell_2("B" + Cstr(CellIndex)) ' set cell value cell_value.Value = reader.GetFoundBarcodeValue(i) cell_filename.Value = objFile.Name ' Write to console WScript.Echo "Extracted barcode '" & reader.GetFoundBarcodeValue(i) & "' from '"& objFile.Name &"' file" Next End If Next For Each subFolder in folder.SubFolders ProcessFolder subFolder Next End Sub

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

run.bat
      
REM running from the command line cscript.exe Code39BarcodeToExcel.vbs "InputFiles" pause

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

60 Day Free Trial or Visit ByteScout BarCode Reader SDK Home Page

Explore ByteScout BarCode Reader SDK Documentation

Explore Samples

Sign Up for ByteScout BarCode Reader SDK Online Training

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next