Sorry guys, this is more of an updated question from a previous question... I managed to figure out the issue I was having with regards to clicking the "Next Results" button in IE and looping it back around to pull the same data, then click the "Next Results" button and pull the same data... so on and so on until... and here's where I'm running into the problem. I keep getting an "Object required" error on my "Loop Until" statement... I've tried a number of different workarounds, switching to variables, etc. but still running into errors. Basically I would just like the loop to stop once the "Next Results" button is no longer available (which will obviously happen when there is no more data to pull).
Here's the section of VBA causing the problem...
Dim TDelements As IHTMLElementCollection
Dim TDelement As HTMLTableCell
Dim r As Long
Set TDelements = IE.document.getElementsByTagName("tr")
r = 0
Do
Application.Wait Now + TimeValue("00:00:03")
For Each TDelement In TDelements
If TDelement.className = "searchActivityResultsContent" Then
Sheet1.Range("E1").Offset(r, 0).Value = TDelement.ChildNodes(8).innerText
r = r + 1
ElseIf TDelement.className = "searchActivityResultsContent" Then
Sheet1.Range("E1").Offset(r, 0).Value = TDelement.ChildNodes(8).innerText
r = r + 1
End If
Next
Application.Wait Now + TimeValue("00:00:02")
Set elems = IE.document.getElementsByTagName("input")
For Each e In elems
If e.Value = "Next Results" Then
e.Click
Exit For
End If
Next e
Loop Until e.Value <> "Next Results"
Do Until Not IE.Busy And IE.readyState = 4
DoEvents
Loop
IE.Quit
Here's the HTML code for the buttons I'm referring to...
<table class="contentTable" align="center">
<tr class="contentTableTR">
<form name="scrollResultListForm" method="post" action="/scrollTransactionsList.do" onsubmit="return isBusy();">
<input type="submit" name="action" value="Next Results" onmouseover="showComment(event,'Display next results')" onmouseout="hideComment()" class="formButton">
<input type="submit" name="action" value="Last Page" onmouseover="showComment(event,'Goto last result page')" onmouseout="hideComment()" class="formButton">
</form>
</tr>
</table>