Advertisement
Guest User

Export contacts from outlook inbox

a guest
May 26th, 2011
1,016
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. Sub GetALLEmailAddresses()
  2.  
  3. Dim objFolder As MAPIFolder
  4. Dim strEmail As String
  5. Dim strEmails As String
  6. ''' Requires reference to Microsoft Scripting Runtime
  7. Dim dic As New Dictionary
  8. Dim objItem As Object
  9.  
  10. ''Set objFolder = Application.ActiveExplorer.Selection
  11. Set objFolder = Application.GetNamespace("Mapi").PickFolder
  12.  
  13. For Each objItem In objFolder.Items
  14.  
  15. If objItem.Class = olMail Then
  16.  
  17. strEmail = objItem.SenderEmailAddress
  18.  
  19. If Not dic.Exists(strEmail) Then
  20.  
  21. strEmails = strEmails + strEmail + vbCrLf
  22.  
  23. dic.Add strEmail, ""
  24.  
  25. End If
  26.  
  27. End If
  28.  
  29. Next
  30.  
  31. Debug.Print strEmails
  32.  
  33. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement