Hi
Aneel,
Just use the loop as for i=1 to rowcount+column count instead of using :
For I= 1 to strrowcnt , For J = 1 to strcolcnt
And 2nd one is : objexcel.worksheets("Sheet1").hyperlinks(i).follow
instead of using had-coded value 1.
So overall new script is as below:
Set objFSO = createobject("Scripting.Filesystemobject")
Set objexcel = createobject("Excel.Application")
If objFSO.fileexists("C:\anil.xlsx")Then
objexcel.workbooks.open("C:\anil.xlsx")
strrowcnt= objexcel.worksheets("Login Sheet").usedrange.rows.count
strcolcnt= objexcel.worksheets("Login Sheet").usedrange.columns.count
For I= 1 to strrowcnt+strcolcnt
objexcel.worksheets("Sheet1").hyperlinks(I).follow
Next
Next
Set objFSO = Nothing
Set objexcel = Nothing
Regards,
Poorna.
On Sunday, June 16, 2013 12:11:10 PM UTC+5:30, Aneel wrote:
>
> Hi All,
>
> I have two hyperlinks in Excel sheet and i want to click both of the
> links, i am using below code.
>
> That code clicks only one hyperlink which i have created first i.e. If
> first i created a hyperlink on cell (A2) and then i created second link on
> Cell (A1) then below code is clicking only on hyperlink which is on Cell
> (A2), i am unable to click on first hyperlink i.e. on Cell (A1)
>
> Set objFSO = createobject("Scripting.Filesystemobject")
> Set objexcel = createobject("Excel.Application")
> If objFSO.fileexists("C:\anil.xlsx")Then
> objexcel.workbooks.open("C:\anil.xlsx")
> strrowcnt= objexcel.worksheets("Login Sheet").usedrange.rows.count
> strcolcnt= objexcel.worksheets("Login Sheet").usedrange.columns.count
> For I= 1 to strrowcnt
> For J = 1 to strcolcnt
> objexcel.worksheets("Sheet1").hyperlinks(1).follow
> Next
> Next
>
>
> Set objFSO = Nothing
> Set objexcel = Nothing
>
>
>
> Thanks and Regards,
> Aneel
>
>
>
--
--
You received this message because you are subscribed to the Google
"QTP - HP Quick Test Professional - Automated Software Testing"
group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/MercuryQTP?hl=en
---
You received this message because you are subscribed to the Google Groups "QTP
- HP Quick Test Professional - Automated Software Testing" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.