Reverse Phone Lookup Macro

drmingle

Board Regular
Joined
Oct 5, 2009
Messages
229
This is not my code. However, I would like to use it or some variation.


My Objective: I simply would like to provide either:
  • An address, or
  • First and Last Name
...and have the web service present results which I can extract into an active spreadsheet.

Any help would be appreciated.

Code:
Private Sub parse_digits(npa As String, digits As String, ph_text As String)
    Dim i As Long, c As String
 
    npa = ""
    digits = ""
 
    i = 0
    While i < Len(ph_text) And Len(npa) < 3
        i = i + 1
        c = Mid(ph_text, i, 1)
        If IsNumeric(c) Then npa = npa & c
    Wend
 
    While i < Len(ph_text) And Len(digits) < 7
        i = i + 1
        c = Mid(ph_text, i, 1)
        If IsNumeric(c) Then digits = digits & c
    Wend
End Sub
Public Sub ReverseNumberLookup(oRecord As IBBDataObject)
    Dim oAddr As CConstitAddress
    If TypeOf oRecord Is CRecord Then
        '*** Got a constituent.  Find the preferred address.
        Dim oRec As CRecord
        Set oRec = oRecord
        For Each oAddr In oRec.Addresses
            If oAddr.Fields(CONSTIT_ADDRESS_fld_PREFERRED) Then Exit For
        Next oAddr
    ElseIf TypeOf oRecord Is CConstitAddress Then
        '*** Got an address.  Use it.
        Set oAddr = oRecord
    End If
    Dim ph As IBBPhone
    For Each ph In oAddr.Phones
        Dim npa As String, digits As String
        Call parse_digits(npa, digits, ph.Fields(Phone_fld_Num))
        If Len(npa & digits) = 10 Then
 
            ' Needs reference to "Microsoft Internet Controls"
            ' Usually found at: C:\WINDOWS\System32\shdocvw.dll
 
            Dim oIE As InternetExplorer
            Set oIE = New InternetExplorer
            oIE.Visible = True
            oIE.Navigate ("[URL]http://anywho.com/qry/wp_rl?npa[/URL]=" & npa & "&telephone=" & digits)
 
        End If
 
    Next ph
End Sub
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
There are several services available regarding that with elegant GUI interface. They help you to find such details for free. Their are also paid services to find more in-depth details. Such as

https://www.whitepages.com
https://www.zlookup.com

and many more. You can go through a comprehensive review of such services through this article

https://www.techwhoop.com/reverse-phone-lookup-services/

Hi

Thank you for the reply. The article was indeed helpful. Also, the links provided were very useful.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,823
Members
449,470
Latest member
Subhash Chand

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top