How to Quickly Pack & Attach Multiple Contacts to an Outlook Email

If you need to send a great number of contacts to someone via email, you may want to pack and compress these contacts into a zip file. In this article, we will introduce a quick method to you.

At times, you may be required to forward multiple contacts to someone via a mail. In this case, if there are hundreds of contacts to be sent, you may want to pack and attach them as a zip file to an email, instead of attaching them separately to an email. So, here we will share a quick means with you.

Pack & Attach Multiple Contacts to an Email

  1. For a start, launch Outlook application.
  2. Then, trigger Outlook VBA editor according to “How to Run VBA Code in Your Outlook“.
  3. Next, put the following code into an unused module.
Sub PackAttachMultipleContactsToEmail()
    Dim objSelection As Outlook.Selection
    Dim objItem As Object
    Dim objContact As Outlook.ContactItem
    Dim strFullName As String
    Dim varTempFolder As Variant
    Dim varZipFile As Variant
    Dim objShell As Object
    Dim objFileSystem As Object
    Dim objMail As Outlook.MailItem

    'Get the selected contacts
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
 
    If Not (objSelection Is Nothing) Then
       'Create a temp folder
       varTempFolder = "E:\TempContacts" & Format(Now, "YYMMDDHHMMSS")
       MkDir (varTempFolder)
       varTempFolder = varTempFolder & "\"

       'Save each Contact as vCard file
       For Each objItem In objSelection
           If TypeOf objItem Is ContactItem Then
              Set objContact = objItem
              strFullName = objContact.FullName

              objContact.SaveAs varTempFolder & strFullName & ".vcf", olVCard
           End If
       Next

       'Create a ZIP file
       varZipFile = "E:\Contacts.zip"
       Open varZipFile For Output As #1
       Print #1, Chr$(80) & Chr$(75) & Chr$(5) & Chr$(6) & String(18, 0)
       Close #1

       'Add the exported vcard files to the ZIP file
       Set objShell = CreateObject("Shell.Application")
       objShell.NameSpace(varZipFile).CopyHere objShell.NameSpace(varTempFolder).Items

       On Error Resume Next
       Do Until objShell.NameSpace(varZipFile).Items.Count = objShell.NameSpace(varTempFolder).Items.Count
          Application.Wait (Now + TimeValue("0:00:01"))
       Loop
       On Error GoTo 0

       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
       objFileSystem.DeleteFolder Left(varTempFolder, Len(varTempFolder) - 1)

       'Attach the zip file to the new email
       Set objMail = Application.CreateItem(olMailItem)
       objMail.Attachments.Add varZipFile
       objMail.Display
    End If
End Sub

VBA Code - Pack & Attach Multiple Contacts to an Email

  1. After that, add this macro to Quick Access Toolbar or ribbon.
  2. Finally, take the steps below to have a try.
  • Frist off, select the contacts that you want.
  • Then, hit the macro button in Quick Access Toolbar or ribbon.Click Macro Button
  • At once, a new mail will display, in which you can see the attached zip file called “Contacts”, as shown in the following figure.Attached ZIP File in Email

Prepare a Powerful PST Fix Tool

Since Outlook data file is prone to corruption, you need to learn some ways to fix PST file. First, you can try Scanpst, the inbox repair utility. However, in the event of severe PST damage, you have to resort to a more robust tool, like DataNumen Outlook Repair.

Author Introduction:

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