How to Auto Save Specific Email Attachments with Outlook VBA?

Admin | Published: 2020-10-07T15:04:58+00:00 | Outlook Tips

“Is there any way to auto save specific email attachments in Outlook?” This is the most asked queries by many of the Outlook users. Because there are lots of users who want to save only some specific file formats attachments from Outlook. But due to the unavailability of any direct methods they are not able to do this. Hence, In this article, we are going to discuss on how to auto save specific email attachments with Outlook VBA. But before starting the blog lets discuss what is VBA and what the use of it?

What is VBA?

Basically, VBA stands for Visual Basic for Application, it helps the users to control Microsoft Outlook within Microsoft Outlook. With the help of VBA codes, users can create macros that can help to perform a complicated and repetitive task in Outlook which is not possible in Outlook.
VBA allows users to take all the advantage of the Outlook object model with application-level events.

How to Auto Save Specific Email Attachments with Outlook VBA?

After understanding the VBA in Outlook let’s move towards the method to save specific attachments in from Outlook

Note: This article contains a programming task so make sure to do the task carefully on your own risk.

Before starting to write a VBScript first you have to create a folder in any local drive on your computer. And always make sure that the folder has enough space to save all the attachments from Outlook. If there is not that much space available, then macros not going to save all attachments.

Now let’s see the steps to auto save email attachments with Outlook VBA

1. Press Alt+F11 to open the VB editor

2. Once the editor is open copy and paste the below VBScript

Public WithEvents olItems As Outlook.Items

Private Sub Application_Startup()
Set olItems = Session.GetDefaultFolder(olFolderInbox).Items
End Sub

Private Sub olItems_ItemAdd(ByVal Item As Object)
Dim NewMail As Outlook.MailItem
Dim Atts As Attachments
Dim Att As Attachment
Dim strPath As String
Dim strName As String

If Item.Class = olMail Then
Set NewMail = Item
End If

Set Atts = Item.Attachments

If Atts.Count > 0 Then
For Each Att In Atts
‘Replace “test” with what you want to look for in attachment name
If InStr(LCase(Att.FileName), “test”) > 0 Then
‘Use your wanted destination folder path to save the attachments
strPath = “C:\Attachments\”
strName = NewMail.Subject & ” ” & Chr(45) & ” ” & Att.FileName
Att.SaveAsFile strPath & strName
End If
Next
End If
End Sub

3. Now, go back to MS Outlook and select the emails from which the specific attachments need to save
4. Then, enable all macros and hit Alt+F8 keys to start the saving

5. Now, choose ExecuteSavin and then Run

6. After that Browse For Folder option to save specific attachments from Outlook emails

7. Now, choose the location to save Outlook attachments

Instant Way to Save Specific attachments from Outlook

An above method is a good approach but this method is only for technical users non-technical users not able to do this which the big disadvantage of this method. Also, it very complicated which takes lots of effort. So, it is better to try an automated solution for this task.

Free Download Now Buy Now 100% Secure

SysTools Outlook Attachment Extractor is the third-part attachment management software that can easily auto save specific email attachments in Outlook. This software is capable to download attachments from Outlook PST, OST, and BAK files. Also extract attachments from Outlook emails, contacts, calendars, tasks, notes, and journals.
The best part of this software is that it comes with various filter option like item filter, date, extension filter for the specific file format, and size filter.

Let see the working steps of the software

1. First, download and install the software

2. Once the software is installed launch it

3. Click on the Add File(s) or Add Folder

4. Choose the Maintain Folder Hierarchy option

5. Now, select the destination location to auto save specific attachments in Outlook

6. From the Filter, section select the Email item

7. Under the Apply Filter, option select the enter the file format extension

8. After all the settings, click on the Extract button to download all attachments

Also Read: How to Extract Outlook Attachments to a Folder

Conclusion

There are many users who want to save specific attachments from Outlook but in the absence of any direct methods, they moved towards VBScript. Therefore, in this article, we have discussed the solution on how to auto save specific email attachments with Outlook VBA. Additionally, we have also discussed an automated way to auto save specific email attachments in Outlook.