2 Methods to Batch Open All the Attachments in Your Outlook Email

When you receive an email which is appended with several attachments, sometimes, you may hope to open them in bulk. This article will look at this issue and introduce you 2 approaches to get it.

You must have ever received such an email which contains several attachments. It is pretty easy to open one of the attachments simply by double clicking on it. But if you would like to quickly open all the attachments in batch, how you can get it? It’s obvious that Outlook doesn’t provide us with such a feature. Hence, you need to seek other means. The followings are 2 tips.

Batch Open All the Attachments

Method 1: Batch Open All the Attachments via Save All Attachments

If the attachments are in the same file type, you can use this method:

  1. To start with, select an email.
  2. Then pitch on one attachment in the reading pane.Select an Attachment in One Email
  3. Next in the visible “Attachments” ribbon, you can find and click on the “Save All Attachments” button.Save All Attachments
  4. Subsequently, in the popup small dialog box, click “OK”.Confirm Save All Attachments
  5. In the following “Save All Attachments” dialog box, select a destination folder for saving them and click “OK”.
  6. Finally you can open the selected folder.
  • Press “Ctrl + A” to select all the saved attachments.
  • Then right click on them.
  • In the right clicking menu, you can select “Open” option.Batch Open All the Attachments in the Same File Type

The above method is only applicable to such a case that all the attachments are in the same file type. But if not, you can use the following means.

Method 2: Batch Open All the Attachments via Outlook VBA

The method will work effectively if the attachments are in common file types – “.docx”, “.doc”, “.txt”, “.xlsx”, “xls”, “.jpg”, “.png”, “jpeg”.

  1. In the first place, press “Alt + F11” key buttons.
  2. Then you will get into VBA editor window.
  3. Now you need to open a module not in use.
  4. Subsequently, copy and paste the following VBA codes into it.
Sub OpenAllAttachments()
    Dim objMail As Outlook.MailItem
    Dim objAttachments As Outlook.attachments
    Dim objAttachment As Outlook.Attachment
    Dim objFileSystem As Object
    Dim objTempFolder As Object
    Dim strFile As String
    Dim objWordApp As Word.Application
    Dim objWordDocument As Word.Document
    Dim objWordRange As Word.Range
    Dim objExcelApp As Excel.Application
    Dim objExcelWorkbook As Excel.Workbook
    Dim objExcelWorkSheet As Excel.Worksheet
    Dim objExcelRange As Excel.Range
 
    Set objMail = Application.ActiveExplorer.Selection.Item(1)
    Set objAttachments = objMail.attachments
 
    If objAttachments.Count > 0 Then
       For Each objAttachment In objAttachments
           'Save the attachments to Temp folder
           Set objFileSystem = CreateObject("Scripting.FileSystemObject")
           Set objTempFolder = objFileSystem.GetSpecialFolder(2)
           strFile = objTempFolder.Path & "\" & objAttachment.DisplayName
           objAttachment.SaveAsFile strFile
 
           'Batch open all the attached Word documents and Text Files
           If InStr(LCase(strFile), "docx") > 0 Or InStr(LCase(strFile), "doc") > 0 Or InStr(LCase(strFile), "txt") > 0 Then
              Set objWordApp = CreateObject("Word.Application")
              Set objWordDocument = objWordApp.Documents.Open(strFile)
              objWordDocument.Activate
              Set objWordRange = objWordDocument.Range(0, 0)
              objWordApp.Visible = True
              objWordDocument.ActiveWindow.Visible = True
           End If
 
          'Batch open all the attached Excel workbooks
          If InStr(LCase(strFile), "xlsx") > 0 Or InStr(LCase(strFile), "xls") > 0 Then
             Set objExcelApp = CreateObject("Excel.Application")
             Set objExcelWorkbook = objExcelApp.Workbooks.Open(strFile)
             Set objExcelWorkSheet = objExcelWorkbook.Sheets(1)
             objExcelWorkSheet.Activate
             Set objExcelRange = objExcelWorkSheet.Range("A1")
             objExcelRange.Activate
             objExcelApp.Visible = True
          End If
 
          'Batch open all the attached pictures via Windows image view
          If InStr(LCase(strFile), "jpg") > 0 Or InStr(LCase(strFile), "png") > 0 Or InStr(LCase(strFile), "jpeg") > 0 Then
             Shell "RunDLL32.exe C:\Windows\System32\Shimgvw.dll,ImageView_Fullscreen " & strFile
          End If
       Next
    End If
End Sub

VBA Codes - Open All Attachments

  1. After that, you can close the VBA editor and add the macro to the Quick Access Toolbar.add the macro to the Quick Access Toolbar
  2. Finally you can have a try.
  • Firstly, select an email.
  • Then click the macro button in Quick Access Toolbar.Try the Macro Button
  • Immediately, all the attachments in the selected email will be opened in batch, like the following screenshot:Batch Open All the Attachments in Common File Types

Safeguard Your PST Data Effectively

As Outlook PST is vulnerable to various factors, you should make a lot of efforts to prevent it from corruption. Otherwise, once your PST gets corrupted, to repair PST will be a considerably arduous task. Scanpst.exe will not help in such a case. So your only resort is to apply a potent external tool, such as 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 damaged mdf and outlook repair software products. For more information visit www.datanumen.com

2 responses to “2 Methods to Batch Open All the Attachments in Your Outlook Email”

  1. Be aware that this code is not for PDF files .
    The method will work effectively if the attachments are in common file types – “.docx”, “.doc”, “.txt”, “.xlsx”, “xls”, “.jpg”, “.png”, “jpeg”.

  2. I am trying to use your macro and I am getting the error “Compile error: User-defined type not defined”. Can you please help?

Leave a Reply

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