none
How to extract all emails from public address book? RRS feed

  • Question

  • Under Microsoft Outlook 2003 --> Tools --> Address Book, how to extract all the email address and export to a file?


    Monday, November 12, 2012 5:09 AM

All replies

  • You can do it with an Outlook macro

    Sub ExtractAllEmails()

    Dim olNS As Outlook.NameSpace
    Dim olContactFolder As Outlook.MAPIFolder
    Dim olContact As Outlook.ContactItem
    Dim olItems As Outlook.Items
    Dim wdApp As Object
    Dim wdDoc As Object
        On Error Resume Next
        Set olNS = GetNamespace("MAPI")
        Set olContactFolder = olNS.GetDefaultFolder(olFolderContacts)
        Set olItems = olContactFolder.Items
        Set wdApp = GetObject(, "Word.Application")
        If Err Then
            Set wdApp = CreateObject("Word.Application")
        End If
        Set wdDoc = wdApp.Documents.Add
        For Each olContact In olItems
            With olContact
                If .Email1Address <> "" Then wdDoc.Range.InsertAfter .Email1Address & vbCr
                If .Email2Address <> "" Then wdDoc.Range.InsertAfter .Email2Address & vbCr
                If .Email3Address <> "" Then wdDoc.Range.InsertAfter .Email3Address & vbCr
            End With
            Err.Clear
        Next
        Set olItems = Nothing
        Set olNS = Nothing
        Set olContactFolder = Nothing
        Set olContact = Nothing
        Set wdApp = Nothing
        Set wdDoc = Nothing

    End Sub


    Graham Mayor - Word MVP
    www.gmayor.com

    Monday, November 12, 2012 10:24 AM
  • I can recommend you a small and Free add-in, to extract whatever you want from Outlook.


    Oskar Shon, Office System MVP

    Press if Helpful; Answer when a problem solved

    Monday, November 12, 2012 6:06 PM
    Answerer