I want to scrape 25000 addresses using Column A cell values as search strings. I'm using the following code, it is working fine but it's too slow to extract 25000 results. Is there any way to speed up the process, like opening multiple addresses at once or something else? I'm pretty new to VBA coding. Any help would be appreciated.
Sub pullAddresses()
Dim IE As Object
Dim Doc As HTMLDocument
Set IE = CreateObject("InternetExplorer.Application")
IE.Visible = True
For introw = 2 To 10
searchstring = ThisWorkbook.Sheets("Sheet1").Range("A" & introw).Value
IE.navigate ("https://www.google.com/search?q=" & searchstring)
Do Until IE.readyState = READYSTATE_COMPLETE
DoEvents
Loop
Set ht = IE.document
''Application.Wait (Now() + TimeValue("00:00:02"))
a = ht.getElementsByClassName("desktop-title-content")(0).innerText
b = ht.getElementsByClassName("desktop-title-subcontent")(0).innerText
ThisWorkbook.Sheets("Sheet1").Range("B" & introw).Value = a & ", " & b
Next
End Sub
"MSXML2.serverXMLHTTP"
to query the page - e.g. as I have done in this answer. Note for multiple requests it's better not to create a whole new serverXMLHTTP object each time (as I'm doing there) and you should just reuse the same one like you are doing in your question forIE
\$\endgroup\$Do Until...Loop
line of code. Unfortunately, you cannot parallelize the operation, since VBA doesn't support threading, either. \$\endgroup\$