Sunday, June 8, 2008

QTP Script to create Excel Sheet and to enter data into it(using script).

To create Excel SheetSet
Excel=createObject("Excel.Application")
Set ExcelSheet=createObject("Excel.sheet")
ExcelSheet.Application.visible=true'

script to enter data(into excel sheet)
Excel.ActiveSheet.cells(1,1).value=1111
Excel.ActiveSheet.cells(1,2).value=2222
Excel.ActiveSheet.cells(2,1).value=3333
Excel.ActiveSheet.cells(2,2).value=4444
ExcelSheet.SaveAs "C:/XYZ.xls"
Excel Sheet is saved in C folder with following data.A B1111 2222 3333 4444