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

Explain actions in qtp ?

0 Answers  


If an application name changes frequently i.e while recording it has the name, in this case, how do qtp handles?

0 Answers  


When to use shared and local object repository?

0 Answers  


Explain in brief about the quicktest professional (qtp) automation object model?

0 Answers  


How do you done Data-Driven Testing using MS-Word. What is the script for that

3 Answers   IBM,






In qtp, how you can remove the spaces from string?

0 Answers  


hi i have one isuue on selecting webcheckbox .there are 15 wecheckboxex i want to select every time 9 th one how can i select plese help me regards balaji

4 Answers  


Hi, i have a string like "INDIA". I need to display this string vertically in Msgbox?

3 Answers  


WHAT ARE THE DISADVANTAGES OF SHARED REPOSITORY?

9 Answers   BirlaSoft,


Ehat is the descriptive programing in QTP?

4 Answers  


wt is the difference between global and action excel database in qtp?for example one action is calling another action the second action is using action excell sheet?if it is using global sheet what makes the difference?

2 Answers   Datamatics,


Why you have to add the specific add in in QTP? My answer is to recognize the specific objects we have to add the add-in in QTP...but he asked again after adding addin how qtp recognize the objects successfully? what is there in the add-in ?

1 Answers   CTS,


Categories