How to Batch Send All Files in a Windows Folder via Separate Outlook Emails

If you would like to send all files in a Windows folder via individual Outlook emails to someone, you can use the method introduced in this article. It is making use of VBA code, which is quite effective.

After reading my previous article – “3 Quick Methods to Attach All Files in a Local Folder to an Outlook Email”, some users want to send all files in a local folder via separate emails. In standard fashion, you should create emails and attach the files one by one. It’s quite troublesome. Therefore, in the followings, we will introduce a more effective way to you.

Batch Send All Files in a Windows Folder via Separate Outlook Emails

Batch Send All Files in a Windows Folder via Separate Emails

  1. First off, start your Outlook program.
  2. Then, in Outlook, access VBA editor in reference to the article – “How to Run VBA Code in Your Outlook”.
  3. Next, copy and paste the following VBA code into a project or a module.
Sub SendAllFilesInSeparateEmails()
    Dim objShell As Object
    Dim objWindowsFolder As Object
    Dim objFile As Object
    Dim strWindowsFolder As String
    Dim objFileSystem As Object
    Dim objMail As Outlook.MailItem
    'Select a Windows folder
    Set objShell = CreateObject("Shell.Application")
    Set objWindowsFolder = objShell.BrowseForFolder(0, "Select a Windows Folder:", 0, "")
    If Not objWindowsFolder Is Nothing Then
       strWindowsFolder = objWindowsFolder.self.Path & "\"
       Set objFileSystem = CreateObject("Scripting.FileSystemObject")
       Set objWindowsFolder = objFileSystem.GetFolder(strWindowsFolder)
       'Send each file in an email
       For Each objFile In objWindowsFolder.Files
           'Create a new mail
           Set objMail = Outlook.Application.CreateItem(olMailItem)
           'Change the details as per your needs
           With objMail
                .Subject = Left(objFile.Name, Len(objFile.Name) - (Len(objFileSystem.GetExtensionName(objFile.Name)) + 1))
                .Attachments.Add objFile.Path
                .Recipients.Add ("")
          End With
       'Prompt you when completing sending
       MsgBox "All done!", vbOKOnly + vbExclamation
    End If
End Sub

VBA Code - Batch Send All Files in a Windows Folder via Separate Emails

  1. After that, you can run this macro at once. Just press “F5” key button.
  2. Subsequently, you would be required to select the source Windows folder in the popup dialog box.Select a Windows Folder
  3. Ultimately, Outlook will attach all the files in this Windows folder to separate emails and send the mails to the predefined recipient.
  4. When it finishes, you will get a message prompting “All done!”.Message prompting "All Done"

Keep an Eye on Outlook Health

Although Outlook has been touted as the most popular email client in the market, it still has a fatal flaw. That is its vulnerability. In other words, Outlook is prone to assorted errors and corruption. Therefore you have to attach great importance to your Outlook health, protecting it from damage. In addition, you have to back up your Outlook files at regular interval. Besides, it is recommended to get hold of a PST fix tool, like DataNumen Outlook Repair. It can repair Outlook issues without any hassles.

Author Introduction:

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

3 responses to “How to Batch Send All Files in a Windows Folder via Separate Outlook Emails”

  1. Hello,

    Great VBA! Very helpful!
    However, instead of sending the emails, what piece of the code we need to change in order to save the emails as Drafts for a manual second control before sending?


Leave a Reply

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