An easy to understand guide on how to add barcode to word document in VB with barcode SDK in Microsoft Word with this source code sample. ByteScout Barcode Suite can add barcode to word document in VB with barcode SDK. It can be applied from Microsoft Word. ByteScout Barcode Suite is the set that includes three different SDK products to generate barcodes, read barcodes and read and write spreadsheets: Barcode SDK, Barcode Reader SDK and Spreadsheet SDK.
The SDK samples given below describe how to quickly make your application do add barcode to word document in VB with barcode SDK in Microsoft Word with the help of ByteScout Barcode Suite. Follow the instructions from scratch to work and copy the Microsoft Word code. Check Microsoft Word sample code samples to see if they respond to your needs and requirements for the project.
The trial version of ByteScout Barcode Suite can be downloaded for free from our website. It also includes source code samples for Microsoft Word and other programming languages.
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
' IMPORTANT: ' Copy input.doc to your my documents folder ' and change the path to "input.doc" below ' Word requires to provide absolute path to input files ' ' Imports System Imports System.Collections.Generic Imports System.Drawing Imports System.IO Imports System.Text Imports System.Windows.Forms Imports Bytescout.BarCode Module Module1 <STAThread()> _ Sub Main() ' Create new barcode Dim barcode As New Barcode() ' Set symbology barcode.Symbology = SymbologyType.Codabar ' Set value barcode.Value = "123456" ' Add checksum to barcode barcode.AddChecksum = True ' Create word instance Dim appWord As New Microsoft.Office.Interop.Word.Application() ' Hide word appWord.Visible = False ' Create missing object Dim mis As Object = System.Reflection.Missing.Value ' Template file - change to the appropraite path where you copied input.doc Dim fileInput As Object = "C:\input.doc" ' Template file - change to the appropraite path where you copied input.doc Dim fileOutput As Object = "C:\output.doc" ' Open document Dim docWord As Microsoft.Office.Interop.Word.Document = appWord.Documents.Open(fileInput, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis) ' Set bookmark name Dim bookmarkName As Object = "MyBookmark" ' Get bookmark location Dim bookmarkLocation As Microsoft.Office.Interop.Word.Range = docWord.Bookmarks(bookmarkName).Range() ' Get barcode image Dim image As Bitmap = DirectCast(barcode.GetImage(), Bitmap) ' Copy image to the clipboard Clipboard.SetDataObject(image) ' Paste barcode image to the document bookmarkLocation.Paste() ' Save to the new document docWord.SaveAs(fileOutput, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis, mis) ' We needn't save changes Dim saveChanges As Object = False ' Close word application appWord.Quit(saveChanges, mis, mis) ' Release COM object System.Runtime.InteropServices.Marshal.ReleaseComObject(appWord) End Sub End Module
60 Day Free Trial or Visit ByteScout Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
60 Day Free Trial or Visit ByteScout Barcode Suite Home Page
Explore ByteScout Barcode Suite Documentation
Explore Samples
Sign Up for ByteScout Barcode Suite Online Training
Get Your API Key
Explore Web API Docs
Explore Web API Samples
also available as: