Vb script program to read values from Excel ? - TestingQ.com

-->Exclusive Portal for Testing Jobs

Vb script program to read values from Excel ?

Ex: create a Excel with a below data
Name  Sal
Test    1000
Demo  2000
save it as Testdata in C drive(if you are using lesser than Ms office 2010 then extension is .xls) 

Set xl =createobject("excel.application")
set wb=xl.workbooks.open("C:\Testdata.xlsx")
set sh=wb.worksheets(1)

rc=sh.usedrange.rows.count
for i=2 to rc
Msgbox "Name: "& sh.cells(i,1).value &vbnewline&" Sal:"&sh.cells(i,2).value
Next
wb.close
xl.quit
set xl=nothing
set wb=nothing
set sh=nothing
To receive daily posted JOBS & Interview Questions
Just enter your email address below and click 'Submit'
Enter your email address:

Make sure to activate your subscription by clicking on the activation link sent to your email