How to Batch Save All Attachments in an Outlook Task to a Windows Folder

If an Outlook task contains many attachments, to extract and save them to a local folder, in general, you have to save them one by one manually. Yet, in this article, we will introduce a method to batch save all attachments in one go.

At times, you may receive a task assigned from someone else. And this task may contain several important attachments in its body. In face of such a task, you may need to extract and save these attachments to a Windows folder. Yet, unlike email, you cannot save them in batches by default. Outlook only allows you to save one by one. Obviously, it will be too tedious if there are too many attachments. Hence, here we will introduce a way to let you accomplish this task in bulk.

Batch Save All Attachments in a Task to a Windows Folder

  1. At the very outset, launch Outlook application.
  2. Then, trigger Outlook VBA editor with reference to “How to Run VBA Code in Your Outlook“.
  3. Next, copy the following code into an unused module.
Sub BatchSaveAttachmentsFromTask()
    Dim objTask As Outlook.TaskItem
    Dim objShell, objWindowsFolder As Object
    Dim strWindowsFolder As String
    Dim objAttachment As Outlook.Attachment
    Dim strFolder, strFilePath As String

    'Get the task
    Select Case Outlook.Application.ActiveWindow.Class
           Case olInspector
                Set objTask = ActiveInspector.CurrentItem
           Case olExplorer
                Set objTask = ActiveExplorer.Selection.Item(1)
    End Select

    'Select a Windows folder for saving extracted attachments
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a folder to save Tasks' attachments:", 0, "")

    If Not objWindowsFolder Is Nothing Then
       strWindowsFolder = objWindowsFolder.self.Path & "\"

       If objTask.Attachments.Count > 0 Then

          For Each objAttachment In objTask.Attachments
              strFilePath = strWindowsFolder & objAttachment.FileName
              objAttachment.SaveAsFile strFilePath
          Next
       End If

       Shell "Explorer.exe" & " " & strWindowsFolder, vbNormalFocus
    End If
End Sub

VBA Code - Batch Save All Attachments in a Task to a Windows Folder

  1. Subsequently, exit the VBA editor.
  2. After that, add this macro to Quick Access Toolbar or ribbon.
  3. Eventually, you can have a try.
  • First off, select or open a task.
  • Then, click the newly added macro button.Run Macro on Task
  • In the popup dialog box, select a Windows folder as per your needs.
  • Afterwards, click “OK”.Select Windows Folder
  • At once, the Windows folder will be displayed, in which you can find the extracted attachments.Saved Attachments

Cope with Disturbing Outlook Issues

As we all know, Outlook PST file is susceptible to various errors and corruption. For instance, if you frequently close your Outlook improperly or you download any malicious files, your Outlook PST file may become inaccessible one day. At that time, even the inbox repair tool is unable to help you. What you can resort to is more experienced and trustworthy PST fix software, like DataNumen Outlook Repair. It can extract maximum Outlook data from a PST file in quick time.

Author Introduction:

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