Results 1 to 2 of 2
  1. #1

    Outlook addresses (from an utter novice)

    I'm trying to go through my email folders and leech out pretty much every email address (and associated information) that I can and add that to my contacts. Does anyone have some pointers on how to go about it?

  2. #2
    New Lounger
    Join Date
    Jun 2001
    OH USA
    Thanked 0 Times in 0 Posts

    Re: Outlook addresses (from an utter novice)

    Here's a brute force approach to listing all of the recipients for all the items in all the folders; cleaning it up is left as an exercise for the student! <img src=/S/devil.gif border=0 alt=devil width=15 height=15>
    Sub test()
    Dim onNameSpace As NameSpace
    Dim olItem As Variant
    Dim onFolders As Folders
    Dim onFolder As MAPIFolder
    Dim I As Integer
    Dim J As Integer
    Dim K As Integer
    Dim x2 As MAPIFolder

    On Error Resume Next
    Set onNameSpace = Application.GetNamespace("MAPI")
    Set onFolders = onNameSpace.Folders
    Set onFolder = onFolders.GetFirst
    Do Until onFolder Is Nothing
    If onFolder.Folders.Count > 0 Then
    For I = 1 To onFolder.Folders.Count
    Set x2 = onFolder.Folders(I)
    For J = 1 To x2.Items.Count
    If x2.Items(J).Class = olMail Then
    If x2.Items(J).Recipients.Count > 0 Then
    For K = 1 To x2.Items(J).Recipients.Count
    Debug.Print x2.Items(J).Recipients(K).Address
    Next K
    End If
    End If
    Next J
    Next I
    End If
    Set onFolder = onFolders.GetNext
    End Sub

    It works on OL2000 - but it sure isn't pretty!
    - Bob

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts