How to Batch Copy All Attachments from Multiple Emails to a New Email in Outlook

If you want to create a new email and append all the attachments in several other emails to the new mail, you can use the method introduced in this article. It’ll teach you to use VBA to get it like a breeze.

At times, you may need to batch copy all the attachments from multiple emails to a new email. Of course, you can select to do it manually, simply by first saving them to local drive and then attaching them to a newly created email one by one. However, apparently, by this means, it will be a quite tedious task. Therefore, why don’t you utilize VBA to quickly realize it? In the followings, we will expose you the elaborate operations and corresponding VBA codes.

Batch Copy All Attachments from Multiple Emails to a New Email

Batch Copy All Attachments from Multiple Emails to a New Email

  1. At the very outset, start your Outlook program as usual.
  2. Next in the main Outlook window, press “Alt + F11” key buttons.
  3. In the subsequent “Microsoft Visual Basic for Applications” window, insert a new module or open a module which is not in use.
  4. Then copy and paste the following VBA codes into such a module.
Sub NewEmailwithAttachmentsinSeveralEmails()
    Dim objSelection As Outlook.Selection
    Dim objMail As Outlook.MailItem
    Dim objAttachment As Outlook.Attachment
    Dim objFileSystem As Object
    Dim strFilePath As String
    Dim objNewMail As Outlook.MailItem
 
    Set objSelection = Outlook.Application.ActiveExplorer.Selection
    Set objNewMail = Outlook.Application.CreateItem(olMailItem)
 
    On Error Resume Next
    For Each objMail In objSelection
        For Each objAttachment In objMail.attachments
 
            'Save all the attachments to temporary folder
            Set objFileSystem = CreateObject("Scripting.FileSystemObject")
            strFilePath = objFileSystem.GetSpecialFolder(2).Path & "\" & objAttachment.filename
            objAttachment.SaveAsFile (strFilePath)
 
            'Add the attachments to the new email
             objNewMail.attachments.Add (strFilePath)
 
            'Delete the temporary files
            objFileSystem.DeleteFile (strFilePath)
        Next
    Next
 
    'Show the new email
    objNewMail.Display
End Sub

VBA Code - Batch Copy All Attachments from Multiple Emails to a New Email

  1. After that, you should proceed to add the new VBA project to Quick Access Toolbar. You can complete it in “Outlook Options”.
  2. Later you ought to change your Outlook macro security level to low.
  3. Finally you can have a try.
  • Firstly, press “Ctrl” key and select several emails whose attachments you want to copy.
  • Then hit the new macro button in the Quick Access Toolbar.
  • Immediately, a new email will pop up with all the attachments attached.

Challenge Frequent Outlook PST Issues

As Outlook PST issues can occur now and then, you should spend a lot of efforts to safeguard your PST data. For instance, you had better back up your PST data on a regular basis, such that you will be able to get back the corrupt Outlook data from backups without breaking a sweat. Moreover, you have to keep a reputable tool in vicinity, 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 repair mdf and outlook repair software products. For more information visit www.datanumen.com

Comments are closed.