shahin
Active Member
I've written a code to get the "name of the coffee shop" against a phone number embedded adjacent to a cell in my excel spreadsheet. My intention is to get the name using the phone number from that page. The phone number against which i am trying to get the name is "323-871-0143". But i'm not being able to grab it. For kind consideration i'm pasting my code below. The code doesn't show any error but to know more about it i used python module to get text of that page but it was unable to get that too. Finally my finding is that i am unable to reach that page using my code where the data belongs because of privacy error or something. I can reach that page only when i write manually the address in the chrome address bar. So my earnest request is that if i could get any helping hand to perform it the way i can get the result. Any help would be greatly appreciated.
Sub ReverseLookup()
Dim http As New MSXML2.XMLHTTP60, html As New MSHTML.HTMLDocument
Dim catgo As Object, data As Object, raw As Object
Dim Phone As String
Worksheets("sheet2").Select
Phone = Range("A1")
http.Open "GET", "http://www.whitepages.com/phone/1-" & Phone, False
http.send
html.body.innerHTML = http.responseText
Set catgo = html.getElementsByClassName("bottom-padding-large grey-text")(0)
Set raw = catgo.getElementsByTagName("p")
Range("B1").Select
For Each data In raw
ActiveCell.Value = data.innerText
ActiveCell.Offset(1, 0).Select
Next data
End Sub
Sub ReverseLookup()
Dim http As New MSXML2.XMLHTTP60, html As New MSHTML.HTMLDocument
Dim catgo As Object, data As Object, raw As Object
Dim Phone As String
Worksheets("sheet2").Select
Phone = Range("A1")
http.Open "GET", "http://www.whitepages.com/phone/1-" & Phone, False
http.send
html.body.innerHTML = http.responseText
Set catgo = html.getElementsByClassName("bottom-padding-large grey-text")(0)
Set raw = catgo.getElementsByTagName("p")
Range("B1").Select
For Each data In raw
ActiveCell.Value = data.innerText
ActiveCell.Offset(1, 0).Select
Next data
End Sub
Last edited: