vbscript1976
Programmer
How to read the data from Excel sheet with file name. i am getting error.
'Extra Object
Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object
Set Sys = CreateObject("EXTRA.System")
Set Sess = Sys.ActiveSession
Set MyScreen = Sess.Screen
'Excel Object
Dim Excel_Obj As Object, Excel_Sheet As Object
Set Excel_Obj = GetObject(,"excel.application") 'gets excel assuming it's open
Set ExcelSheet = CreateObject("excel.sheet")
Set XLApp = CreateObject("Excel.Application")
Set Wbook = XLApp.workbooks.open("C:\Searchmodule\search.xls")
Set Wsheet = Wbook.Worksheets("Sheet1")
' Set Excel_Sheet = Excel_Obj.ActiveSheet 'get the open sheet
Dim TotalRows, Counter As Integer
Dim Column1(),xy,xy2
TotalRows = 0
Redim Column1(TotalRows)
Redim Column2(TotalRows)
'get Excel info
'While Excel_Sheet.Cells(TotalRows+1,1).value <> ""
While Wsheet.Cells(TotalRows+1,1).value <> ""
Redim Preserve Column1(TotalRows+1)
Redim Preserve Column2(TotalRows+1)
Column1(TotalRows+1) = Wsheet.Cells(TotalRows+1,1).value
Column2(TotalRows+1) = Wsheet.Cells(TotalRows+1,2).value
TotalRows = TotalRows+1
wend
'Extra Object
Dim Sys As Object, Sess As Object, MyScreen As Object, MyArea As Object
Set Sys = CreateObject("EXTRA.System")
Set Sess = Sys.ActiveSession
Set MyScreen = Sess.Screen
'Excel Object
Dim Excel_Obj As Object, Excel_Sheet As Object
Set Excel_Obj = GetObject(,"excel.application") 'gets excel assuming it's open
Set ExcelSheet = CreateObject("excel.sheet")
Set XLApp = CreateObject("Excel.Application")
Set Wbook = XLApp.workbooks.open("C:\Searchmodule\search.xls")
Set Wsheet = Wbook.Worksheets("Sheet1")
' Set Excel_Sheet = Excel_Obj.ActiveSheet 'get the open sheet
Dim TotalRows, Counter As Integer
Dim Column1(),xy,xy2
TotalRows = 0
Redim Column1(TotalRows)
Redim Column2(TotalRows)
'get Excel info
'While Excel_Sheet.Cells(TotalRows+1,1).value <> ""
While Wsheet.Cells(TotalRows+1,1).value <> ""
Redim Preserve Column1(TotalRows+1)
Redim Preserve Column2(TotalRows+1)
Column1(TotalRows+1) = Wsheet.Cells(TotalRows+1,1).value
Column2(TotalRows+1) = Wsheet.Cells(TotalRows+1,2).value
TotalRows = TotalRows+1
wend