Sorry to ask for assistance but I've been trying to solve this for weeks. I have a table of date (myTable) and in the first column on each row there is a link to a sub table that I'm trying to scrape. I can collect the table data once it is displayed however i have to call a message box to pause the script while I manually click on each of the links (30+).
This is a sample of the code
I have managed to get the table and I have on occasion managed to click on the first link but can't get it to loop.
This is what I have so far, i'm hoping that I'm on the right track.
This is a sample of the code
HTML:
<TABLE class=mytable>
<TBODY>
<TR class=ScreenOnlyDispNone bgColor=silver>
<TD style="TEXT-ALIGN: center">Shift</TD>
<TD style="TEXT-ALIGN: center">FullName</TD>
<TD style="TEXT-ALIGN: center">Assc</TD>
<TD style="TEXT-ALIGN: center">Date</TD>
<TD style="TEXT-ALIGN: center">Cases</TD>
<TD style="TEXT-ALIGN: center">Std</TD>
<TD style="TEXT-ALIGN: center">Act</TD>
<TD style="TEXT-ALIGN: center">Perf</TD>
<TD style="TEXT-ALIGN: center">Dy hh:MM:ss</TD>
<TD style="TEXT-ALIGN: center">PickRate</TD></TR>
<TR bgColor=lightblue>
<TD id=tblShiftData style="WIDTH: 35px"><[B]A *******="RunRptTot '60','S'" id=linkOff href="">60</A>[/B]</TD>
<TD id=tblFullNameData style="WIDTH: 130px"></TD>
<TD id=tblAsscIDData style="WIDTH: 50px"></TD>
<TD id=tblDateData style="WIDTH: 55px"></TD>
<TD id=tblCasesData>561788</TD>
<TD id=tblStdData>128454.98</TD>
<TD id=tblActData>162753.19</TD>
<TD id=tblPerfData style="WIDTH: 50px">78.93</TD>
<TD id=tblhhMMssData style="TEXT-ALIGN: right">113d 00:33:11</TD>
<TD id=tblPickRateData style="WIDTH: 60px">207.11</TD></TR>
<TR bgColor=lightblue>
<TD><[B]A *******="RunRptTot '61','S'" id=linkOff href="">61</A[/B]></TD>
<TD></TD>
<TD></TD>
etc. etc.
I have managed to get the table and I have on occasion managed to click on the first link but can't get it to loop.
Code:
Sub CycleShiftIDs() ' Go through each shift collecting data
Dim Table_Element As MSHTML.IHTMLElementCollection
Dim tbl As Object, Click As Object, td As Object
For Each tbl In Table_Element
If tbl.className = "mytable" Then
For Each td In Table_Element.getElementsByTagName("td")
If td.innerText = "a" Then
Set Click = Table_Element.getElementById("linkOff")
Click.Click
Do While IE.readyState <> 4: DoEvents: Loop
Call GetTableData
End If
Next
Next
End Sub
This is what I have so far, i'm hoping that I'm on the right track.
Last edited by a moderator: