PShingadia
New Member
- Joined
- Aug 5, 2015
- Messages
- 47
Hi All:
Been struggling all day to write some VBA to loop through links on HTML site but keeps failing and showing error code 0. Please help!! I have the following:
Set HTML = ie.document
Set ElementCol = HTML.getElementsByClassName("ViewLink")
For Each link In ElementCol
If link.innerText = "ViewLink" Then
link.Click
End If
Next link
There are about 10 links and the script for three - in no order - are as follows:
A class=ViewLink id=MainContent_GridView1_btnView_1 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl03$btnView','')">View</A
A class=ViewLink id=MainContent_GridView1_btnView_0 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl02$btnView','')">View</A
A class=ViewLink id=MainContent_GridView1_btnView_6 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl08$btnView','')">View</A
PLease let me know how this should be written
Thanks
Been struggling all day to write some VBA to loop through links on HTML site but keeps failing and showing error code 0. Please help!! I have the following:
Set HTML = ie.document
Set ElementCol = HTML.getElementsByClassName("ViewLink")
For Each link In ElementCol
If link.innerText = "ViewLink" Then
link.Click
End If
Next link
There are about 10 links and the script for three - in no order - are as follows:
A class=ViewLink id=MainContent_GridView1_btnView_1 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl03$btnView','')">View</A
A class=ViewLink id=MainContent_GridView1_btnView_0 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl02$btnView','')">View</A
A class=ViewLink id=MainContent_GridView1_btnView_6 href="javascript:__doPostBack('ctl00$MainContent$GridView1$ctl08$btnView','')">View</A
PLease let me know how this should be written
Thanks
Last edited: