This page helps you to learn from code samples for programming in VB.NET. ByteScout Barcode Suite was created to assist swap cells and their values with spreadsheet sdk in VB.NET. 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.
Save time on writing and testing code by using the code below and use it in your application. If you want to know how it works, then this VB.NET sample code should be copied and pasted into your application’s code editor. Then just compile and run it. These VB.NET sample examples can be used in one or many applications.
Visit our website to get a free trial version of ByteScout Barcode Suite. Free trial contains many of source code samples to help you with your VB.NET project.
Imports System Imports System.Collections.Generic Imports System.Text Imports Bytescout.Spreadsheet Imports System.Diagnostics Imports System.IO Module Module1 Sub Main() ' Open existing Spreadsheets Dim document1 As New Spreadsheet() document1.LoadFromFile("input.xls") ' Get first cell value Dim value1 As Object = document1.Worksheet(0).Cell("A1").Value ' Get another cell value Dim value2 As Object = document1.Worksheet(0).Cell("B1").Value ' Swap them Dim value3 As Object value3 = value2 value2 = value1 value1 = value3 document1.Worksheet(0).Cell("A1").Value = value1 document1.Worksheet(0).Cell("B1").Value = value2 ' remove output file if already exists If File.Exists("Output.xls") Then File.Delete("Output.xls") End If ' Save document document1.SaveAs("Output.xls") ' Close Spreadsheet document1.Close() ' open in default spreadsheets viewer/editor Process.Start("Output.xls") End Sub End Module