VBA Code to Save Email Attachments from Outlook Folder
Looking for a free method to save multiple email attachments from Outlook, then you are landed on the right page. Here we are going to discuss the VBA code to save email attachments from Outlook folder. The best part of these VBA codes that one can easily extract attachments from Outlook without spending a single penny.
Generally, when users want to save attachments from Outlook, then they have to save all the email attachments one by one which is a too cumbersome task. But due to a lack of knowledge about VBA codes, most of the Outlook users use one by one method to save Outlook attachments. So through this blog, we will try to teach you another much quicker way to save Outlook attachments. But before starting the blog let’s have a look at what is VBA and what is VBA codes.
What is VBA?
VBA stand for Visual Basic for Applications and it a part of Microsoft. Basically, it is built to help the programmers to write and build a program for Windows Operating Systems. VBA runs as an internal programing language in MS Office applications. Generally, with the help of VBA codes users can customize the MS Office applications beyond what is normally available.
Now after understanding what is VBA lets jump into the blog.
VBA Code to Save Email Attachments from Outlook Folder
Note: This blog contains a conceptual overview, programming task, so follow all the steps carefully and at your own risk.
To begin the task first you have to create a folder in any drive. Now, start your Outlook program. Once Outlook is open then, follow the listed below steps.
1. Press Alt+F11 together to open the VB editor.
2. Now, copy or write the below VB code to the VB editor
Private Sub Outlook_VBA_Save_Attachment()
”Variable declarions
Dim ns As NameSpace
Dim inb As Folder
Dim itm As MailItem
Dim atch As Attachment
”Variables Initialization
Set ns = Outlook.GetNamespace(“MAPI”)
Set inb = ns.GetDefaultFolder(olFolderInbox)
File_Path = “D:\attach\”
”Loop Thru Each Mail Item
For Each itm In inb.Items
”Loop Thru Each Attachment
For Each atch In itm.Attachments
If atch.type = olByValue Then
atch.SaveAsFile File_Path & atch.FileName
End If
Next atch
Next itm
””’Notify the Termination of Process
MsgBox “Attachments Extracted to: ” & File_Path
End Sub
Note: Code Source stackoverflow.com
3. Once the code is done press F5 to execute the code.
4. Once the execution of code is completed, all your email attachments from Outlook will be saved to your allocated folder.
Note: Always make sure that your folder has enough space available otherwise the codes will not save all attachments from the Outlook folder.
Save Email Attachments from Outlook Folder Smartly
The above solutions on VBA code to save email attachments from Outlook folder definitely works. But the above codes are not for non-technical users only technique users can understand the codes and they will able to solve any issue occurs while executing the code or after the execution of VB codes. Also, if you have many email attachments saved in Outlook, then this will take a lot of time.
Therefore, I think this is not the perfect solution because it is not for everyone and in my opinion a perfect solution can be executed by a normal as well as technique users. Hence, in this section, we have come with a perfect solution that saves multiple email attachments from Outlook.
SysTools Outlook Attachment Extractor is an automated third-party software that can easily save all your Outlook attachments without writing a single line code. The developer of the tool designed this tool in such a manner that anyone can use this tool without any hassle. Also, it is capable to extract attachments from Outlook emails, contacts, calendars, tasks, notes, and journals. This software supports Outlook OST, PST, and BAK files.
Here are the steps to save email attachments from the Outlook folder
1. Download the software from the above download link
2. Once the downloading is completed install the software
3. Now, run the tool and click on the Add File(s) or Add Folder to all the Outlook files.
4. Select the Maintain Folder Hierarchy option to preserve the folder hierarchy as the same
5. Select the Change button to allocate the destination location
6. Select Email option from Select Items Type
7. After all the settings, click on the Extract button to save the attachments from Outlook easily
Also Read: Cannot Save the Attachments in Outlook
Conclusion
There are lots of Outlook users searching for the query “VBA code to save email attachments from Outlook folder” but due to its complications, not that many of the resources available on the internet. Therefore, in this article, we have discussed, all the possible points about VBA code and how to use it to save email attachments from Outlook. Along with that, we have also discussed, an automated solution to download email attachments from Outlook. So now it is up to you to choose the methods as per your requirements