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?



Suppose there is a link present somewhere in an excel sheet. Find the link and click on it. How to..

Answer / 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

More QTP Interview Questions

I am just a beginner in QTP. Could any one explain me in detail how to automate adding two numbers and getting the result in QTP. Also I would like to parameterize the inputs. I have tried but getting an error like 'Can't use sub.....'(can't recollect the exact error)

2 Answers  


what r the main attributes of test automation?

0 Answers  


how can we write descriptive programming for menus when qtp is not able to identify it..and how can we write descriptive programming for partially identified and non standard objects..do i have to map the objects before writing the script

2 Answers  


I used child objects to get the no of weblist present in the weblist.now i need to select the items present in each weblist ?How to do so

0 Answers  


tell me exact differenceb bw qtp and selenium?(could not tell open soure and licennce? difference in usage and technical difference?

0 Answers  


In a webtable,a list of values are there,rightnow one values shows,later random another values shows,but how to retrieve the random value in webtable.

1 Answers   HP,


Explain types of descriptive programming?

0 Answers  


HOW MANY WAYS ARE THERE TO CPY TEST IN TEST LAB

2 Answers   IGT,


Inserting a Call to Action is not importing all columns in Datatable of globalsheet. Why?

1 Answers   Crea,


Actually How do we use this Smart Identification Technology during Recording mode.

1 Answers  


In QTP if u got a defect , how to report to developer using Test director or Quality center .

5 Answers   Wipro,


I have the script like this: Browser("Login").Page ("Application").Frame("ScopeFrame").Link("DC3701737 (Active)").Click in which the value "DC3701737" will get changed and i have to use the same value in so many places. I got the value "DC3701737" in to a variable(Say x). Now if i want to pass the variable in to link object .. how? Browser("Login").Page("Application").Frame ("ScopeFrame").Link(x).Click Is it possible to pass any variable into a link object .. so, that the application will select that link automatically? If ur not able to understand, pls let me know.

2 Answers   ABC,


Categories