Need to activate sheet2 in Excel and get the data from sheet 2, rather than sheet1

rituhooda

Member
Joined
Mar 10, 2010
Messages
13
Programming Experience
Beginner
Dim textFileName As String = Settings.ResultFile
Dim textFile As IO.StreamWriter = IO.File.CreateText(textFileName)
Dim xCelApp As New Excel.Application
Dim oWB As Excel.Workbook = xCelApp.Workbooks.Open(Settings.FileName)
Dim oWS As Excel.Worksheet = oWB.SheetActivate("Sheet2")
 
I want to write Excel data from sheet2 to a text file, but the program doesn't recognize sheet2, and doesn't write any data to my text file.
 
Back
Top