Hello all! I'm trying to grab the search result URLS from this search (http://www.searchtempest.com/search?...sk=&subcat=sss), and paste them into the A column of my worksheet.
This is what I have so far
Sub UrlGrab()
Dim URL As String
Dim HTMLdoc As Object
Dim Anchor As Object
Dim Anchors As Object
URL = "http://www.searchtempest.com/search?search_string=motorcycle+-sign+-vest+-camper+-scooter+-jacket+-goggles+-kids+-helmet+-gloves+-attorney+-repairs+-parts+-stock+-trailer&category=8&Region=na&cityselect=zip&location=37923&maxDist=1500®ion_us=1&srchType=&hasPic=&keytype=adv&minAsk=&maxAsk=&subcat=sss"
Set XMLHTTP = CreateObject("WinHttp.WinHttpRequest.5.1")
XMLHTTP.Open "GET", URL, False
XMLHTTP.send
text = XMLHTTP.responseText
Set HTMLdoc = CreateObject("htmlfile")
HTMLdoc.Write text
HTMLdoc.Close
Set Anchors = HTMLdoc.getElementsByTagName("gs-result")
For Each Anchor In Anchors
If Anchor.className = "gs-title" Then
Rng.Offset(row, 0).Value = Anchor.href
row = row + 1
End If
Next Anchor
MsgBox "Done!"
End Sub
But nothing happens when I execute this, and only the Message Box appears and Im not sure what i'm doing incorrectly. Any help is appreciated!
Bookmarks