How to Batch Add All Recipients of Multiple Emails to Outlook Contacts

Some users long for a solution which allows them to quickly add all the recipients of multiple emails to the Outlook Contacts folder as new contacts. So, this article will introduce such a quick approach.

For example, you receive some emails that are simultaneously sent to many other recipients except you. Moreover, these recipients are not stored in your Outlook Contacts. In this case, you may want to add these recipients to Outlook Contacts. To achieve it in batches, you can use the following way.

Batch Add All Recipients of Multiple Emails to Outlook Contacts

Batch Add All Recipients of Multiple Emails to Outlook Contacts

  1. To begin with, launch your Outlook program.
  2. Then, press “Alt + F11” key buttons to access Outlook VBA eidtor.
  3. Subsequently, in the “Microsoft Visual Basic for Applications” window, copy and paste the following code into a blank module.
Sub AddRecipientsToContacts()
    Dim objSelection As Outlook.Selection
    Dim objMail As Outlook.MailItem
    Dim objRecipients As Outlook.Recipients
    Dim objRecipient As Outlook.Recipient
    Dim strEmailAddress, strName As String
    Dim objContact As Outlook.ContactItem
 
    'Get the selected email
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
   
    If Not (objSelection Is Nothing) Then
       On Error Resume Next
       For Each objMail In objSelection
           Set objRecipients = objMail.Recipients
           For Each objRecipient In objRecipients
               'Exclude yourself in recipient list
               If objRecipient <> Session.CurrentUser Then
                  'Get the email address & name
                  strEmailAddress = objRecipient.Address
                  strName = Split(strEmailAddress, "@")(0)
                  strName = UCase(Left(strName, 1)) & LCase(Right(strName, Len(strName) - 1))
 
                  'Create a new contact for this recipient
                  Set objContact = Outlook.Application.CreateItem(olContactItem)
                  With objContact
                      .FullName = strName
                      .Email1Address = strEmailAddress
                      .Email1DisplayName = .FullName & " (" & strEmailAddress & ")"
                      .Save
                 End With
               End If
           Next
       Next
    End If
End Sub

VBA Code - Batch Add All Recipients of Multiple Emails to Outlook Contacts

  1. After that, minimize or exit this window.
  2. Later, you ought to add this macro to Quick Access Toolbar with reference to “How to Run VBA Code in Your Outlook”.
  3. Finally, you can try this macro.
  • At first, select multiple emails whose recipients to be added to contacts.
  • Then, click the macro button in Quick Access Toolbar.Run Macro on Selected Emails
  • When the macro finishes, you can go to the default Contacts folder. Those recipients have been added.Email Contacts from Recipients
  • The new contact will look like the following screenshot.New Contact

Look out All Risks around Your Outlook

Though Outlook comes endowed with diverse features, it is vulnerable to many factors including human errors, software faults, hardware issues and viruses. So, it is necessary for us to keep an eye out for all potential risks around our Outlook. Also, making sufficient precautions is a matter of necessity. For example, you are better off getting hold of a PST fix tool, such as DataNumen Outlook Repair, which can repair PST problems with effortless ease.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair mdf and outlook repair software products. For more information visit www.datanumen.com

3 responses to “How to Batch Add All Recipients of Multiple Emails to Outlook Contacts”

  1. Sub AddRecipientsToContacts()
    Dim objSelection As Outlook.Selection
    Dim objMail As Outlook.MailItem
    Dim myItem As Outlook.MailItem
    Dim RealName As String
    Dim objRecipients As Outlook.Recipients
    Dim objRecipient As Outlook.Recipient
    Dim Namen() As String
    Dim objRecip As Variant
    Dim strEmailAddress, strName As String
    Dim objContact As Outlook.ContactItem
    Set objNS = Application.GetNamespace(“MAPI”)
    Set colContacts = objNS.GetDefaultFolder(olFolderContacts).Items
    ‘Get the selected email
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
    If Not objSelection Is Nothing Then
    On Error Resume Next
    For Each objMail In objSelection
    Set objRecipients = objMail.Sender
    For Each objRecipient In objRecipients
    ‘Exclude yourself in recipient list
    If objRecipient Session.CurrentUser Then
    For Each objRecip In objMail.Recipients
    ‘ check to see if the recip is already in Contacts
    strAddress = AddQuote(objRecip.Address)
    For i = 1 To 3
    strFind = “[Email” & i & “Address] = ” & strAddress
    Set objContact = colContacts.Find(strFind)
    If Not objContact Is Nothing Then
    GoTo Continue
    End If
    Next
    Next
    strEmailAddress = strAddress
    strName = Split(strEmailAddress, “@”)(0)
    If InStr(strName, “.”) > 0 Then
    Namen = Split(strName, “.”)
    strName = StrConv(Namen(0), vbProperCase) & ” ” & StrConv(Namen(1), vbProperCase)
    Else
    strName = UCase(Left(strName, 1)) & LCase(Right(strName, Len(strName) – 1))
    End If
    ‘Create a new contact for this recipient
    Set objContact = Outlook.Application.CreateItem(olContactItem)
    With objContact
    ‘.FullName = strName
    If objMail.SenderName vbNullString Then
    .FullName = objMail.SenderName
    Else
    .FullName = strEmailAddress
    End If
    .Email1Address = strEmailAddress
    .Email1DisplayName = .FullName & ” (” & strEmailAddress & “)”
    .Save
    End With
    End If
    Continue:
    Next
    Next
    End If
    End Sub
    Function AddQuote(MyText) As String
    AddQuote = Chr(34) & MyText & Chr(34)
    End Function

Leave a Reply

Your email address will not be published. Required fields are marked *