How to Batch Extract All Attachments from Multiple Outlook Contacts

Outlook doesn’t support you to batch extract all attachments from a contact to your local drive, not to mention extracting from multiple contacts. Thus, this article will teach you how to save all attachments from many contacts in one go.

To extract all attachments from an email, you can select the attachments and then click “Save All Attachments” in “Attachments” ribbon. However, such a ribbon is not available for contacts when you select attachments in a contact. That is to say, Outlook doesn’t offer any direct functions to save all attachments from a contact, not to mention processing many contacts in bulk. Hence, to realize it, you need to utilize other means, such as the following one.Batch Extract All Attachments from Multiple Outlook Contacts

Batch Extract All Attachments from Multiple Contacts

  1. In the first place, tap on “Alt + F11” keys to access VBA editor in Outlook.
  2. Then, copy and paste the following VBA code into a module.
Sub ExtractAttachmentsFromContacts()
    Dim objSelection As Outlook.Selection
    Dim objShell, objWindowsFolder As Object
    Dim strWindowsFolder As String
    Dim objContact As Outlook.ContactItem
    Dim objAttachment As Outlook.Attachment
    Dim strFolder, strFilePath As String
 
    Set objSelection = Outlook.ActiveExplorer.Selection
 
    If Not (objSelection Is Nothing) Then
  
       'Select a Windows folder for saving extracted attachments
       Set objShell = CreateObject("Shell.Application")
       Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a folder to save Contacts' attachments:", 0, "")
 
       If Not objWindowsFolder Is Nothing Then
          strWindowsFolder = objWindowsFolder.self.Path & "\"
 
          For Each objContact In objSelection
              If objContact.Attachments.Count > 0 Then
                 'Create a new folder for the contact
                 strFolder = strWindowsFolder & objContact.FullName & "\"
                 MkDir (strFolder)
                 'Save this contact's attachments in this new folder
                 For Each objAttachment In objContact.Attachments
                     strFilePath = strFolder & objAttachment.DisplayName
                     objAttachment.SaveAsFile strFilePath
                 Next
             End If
         Next
 
         MsgBox "Completed!", vbInformation + vbOKOnly, "Extract Attachments"
      End If
    End If
End Sub

VBA Code - Batch Extract All Attachments from Multiple Contacts

  1. After that, exit the VBA editor.
  2. Then, go to “Outlook Options” to add this new macro to Quick Access Toolbar, with reference to “How to Run VBA Code in Your Outlook“.
  3. Later, you can have a try.
  • For a start, select the source contacts.
  • Then, click the macro button in Quick Access Toolbar.Launch Macro
  • Next, you need to choose a Windows folder for saving the attachments.Select Windows Folder
  • When you get the message of “Completed”, go to the selected Windows folder.
  • You can see several new folders named by the contacts’ full names.
  • They’re storing the attachments of the contacts, like the image below.Extracted Attachments in Separate Folders

Combat against All Potential Threats

Outlook is exactly threatened by various dangerous factors, including virus, user mistakes, and software failures and so on. Hence, it is necessary for you to block these risks. For instance, to fire back against viruses, you need to beware of mails from unknown persons and install antivirus software on your computer. Also, in the meantime, you are better off holding a brilliant and credible PST fix tool, such as DataNumen Outlook Repair. Thereby, you’re able to get back data from the damaged PST file with ease.

Author Introduction:

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