Selenium Script

Explore Selenium Automation

QTP SCRIPT : CREATE CELL IN EXCEL SHEET

Excel sheet is really nice and major component of QTP 11 and all the version. Major test data are store and use from excel sheet. To make nice datasheet in QTP, We should able to create cell in ExcelSheet using QTP and i am trying to share code to do that.

Major part : Try to close excelsheet always otherwise it will keep that instant open and will create unexpected error. Try to set nothing value to that object. Please creat excelsheet in any path and change the page of code to run the code.

Dim Excel,ExcelSheet

Set Excelone=CreateObject(“Excel.Application”)
Set ExcelSheet=CreateObject(“Excel.Sheet”)

ExcelSheet.Application.visible=true

ExcelSheet.ActiveSheet.Cells(1,1).value=1
ExcelSheet.ActiveSheet.Cells(1,2).value=2
ExcelSheet.ActiveSheet.Cells(1,3).value=3
Excelone.Saveas “E:\tests.xls”

Excelone.quit
Set ExcelSheet=Nothing

Comments are currently closed.