Suppose there is a link present somewhere in an excel sheet.
Find the link and click on it. How to write a script using
Excel application object in QTP?

Answer Posted / anup muralidharan nair

'Assume the link present in excel that you want to click is
'www.google.co.in

set oxls = createobject("excel.application")
set obook = oxls.workbooks.open("D:\excel.xls")
set osheet = obook.worksheets("sheet1")

'Retrieve all the hyperlinks within the sheet
set ohyper = osheet.hyperlinks
for each hyp in ohyper
If hyp.name = "www.google.co.in" Then
hyp.follow
End If
next

'close the book and release the excel object
obook.close
set obook = nothing
set oxls = nothing

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the automation metrice in your project?

1700


How to analyzing the checpoint results?

505


What is parameter in qtp?

667


What is the difference between local and shared object repository in qtp?

542


What are the advantages of qtp?

563






what are all the fileds present in object repository?

1547


who QTP recognizes the object stored in object repository?

1649


terminal services client

1774


What is the difference between per-action and shared?

578


In qtp, how you can exit for loop?

513


Explain advantages and disadvantages kdf?

509


When I click on a link in web page.Link should open in new window.can anyone please let me know the script for this ---Koti

2473


Give the syntax to load function at run time.

610


what is description object?

1578


I am getting an error "failed to open the XML checkpoint result viewer" in result window,after clicking on "View XML checkpoint results".Someone suggest me settings,if any...

1450