Read excel using qtp descriptive programing

Answers were Sorted based on User's Feedback



Read excel using qtp descriptive programing..

Answer / bindu

'Create Excel Object
Set excel=createobject("excel.application")
'Make it Visible
excel.Visible=True
'Open the Excel File
Set workbook=excel.Workbooks.Open("D:\excel.xls")
'Get the Control on Specific Sheet
Set worksheet1=workbook.Worksheets.Item("Sheet1")
'get rows count
a1=worksheet1.usedrange.rows.count
'get columns count
a2=worksheet1.usedrange.columns.count
msgbox a1
msgbox a2
For i=1 to a1
celltext=" "
For j=1 to a2
celltext=worksheet1.cells(i,j)
msgbox celltext
Next
Next
workbook1.close
set excel=nothing

Is This Answer Correct ?    3 Yes 0 No

Read excel using qtp descriptive programing..

Answer / debashish

‘read excel sheet
dim xl,wb,ws
set xl=createobject("excel.application")
set wb=xl.workbooks.open("H:\asis excel.xlsx")
xl.DisplayAlerts=False
set ws=wb.worksheets("sheet1")
r=ws.usedrange.rows.count
c=ws.usedrange.columns.count
For i=1 to r
v=""
For j=1 to c
v=v &" "& ws.cells(i,j)
Next
msgbox v
'msgbox"-----------------------"
Next
'For i = 1 to r
' For j =1 to c
'msgbox ws.cells(i,j)

' Next
'next
wb.save
wb.close
set xl=nothing

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More QTP Interview Questions

which checkpoint we use to validate yahoo login screen window after login with ur id and password in qtp

8 Answers   Covansys,


what is the frame work in J-meter?

0 Answers  


What is the use of text output value in quicktest professional (qtp)?

0 Answers  


Hi anyone having QTP 10.0 licence or crack version pls send me in this mail id mdilipkumar04@gmail.com Regards Dilip

1 Answers  


give me an example where u used good judgement and logic in solving a problem

0 Answers  






for example u can take ebay or plifcart online shoping web application--------- write acode in vbscript in qtp---- search box and write (iphone6)and click on go button then opened diff prise iphones in next page but u can select 30,000 to 90,000 list pls write code? 

2 Answers   FFASVA, Genpact, Wipro,


Give the syntax to import/export xls into qtp.

0 Answers  


Which property do you use to retrieve or assign data into a cell in a Data Table object?

1 Answers  


what is the script to select 2 or more than 2 options from a listbox.

2 Answers   Polaris,


Can any one send me the QTP Basic Coding Samples?

0 Answers  


Explain in brief about the QTP Automation Object Model.

0 Answers   Crea,


3. Anyone pls tell me as many points as possible for this question? what r the things to take into consideration before automating an application like; a). Identify whether the tool supports the appln or not. b). When there is lot of retesting and regression testing. c). ROI. d). When there is a need for running same script for multiple datas, etc. e). ---- f). --------- Pls give me more points.

1 Answers  


Categories