Mattestion
New Member
- Joined
- May 22, 2011
- Messages
- 19
I'm doing a reverse address search on Canada411 and then trying to get all the names and phone numbers on the results page into excel. I have no problem navigating to the site and submitting my info. It's trying to get the names I can't figure out. I see the name is in a link but I don't know how to distinguish that link from the others (no name,value,etc. attribute).
Here is my code so far:
Here is my code so far:
Code:
Sub TelephonePull()
Dim ie As Object
Dim doc As Object
Set ie = CreateObject("internetexplorer.application")
ie.Visible = True
ie.navigate "http://www.canada411.ca/?old=no" 'This is so we go to the new version of Canada411
Do
If ie.readyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
ie.navigate "http://www.canada411.ca/search/address.html"
Do
If ie.readyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
Set doc = ie.document
doc.getelementbyid("st").Value = "85 BRITTANY"
doc.getelementbyid("ci").Value = "MONT-ROYAL"
doc.getelementbyid("pv").Value = "QC"
doc.getelementbyid("c411AddressFind").Click
Do
If ie.readyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
Do While doc.readyState <> "complete": DoEvents: Loop
Set doc = ie.document
doc.getelementbyid("c411PerPage").Value = "50"
doc.getelementbyid("c411PerPage").FireEvent ("onchange")
Do
If ie.readyState = 4 Then
Exit Do
Else
DoEvents
End If
Loop
Do While doc.readyState <> "complete": DoEvents: Loop
'Code for getting names and phone numbers on results page
End Sub
Last edited: