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 Emails
- First off, start your Outlook program.
- Then, in Outlook, access VBA editor in reference to the article – “How to Run VBA Code in Your Outlook”.
- 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 ("someone@datanumen.com") .Recipients.ResolveAll .Send End With Next 'Prompt you when completing sending MsgBox "All done!", vbOKOnly + vbExclamation End If End Sub
- After that, you can run this macro at once. Just press “F5” key button.
- Subsequently, you would be required to select the source Windows folder in the popup dialog box.
- Ultimately, Outlook will attach all the files in this Windows folder to separate emails and send the mails to the predefined recipient.
- When it finishes, you will get a 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 www.datanumen.com
Found it!
In order to Save as Draft, needs only to replace
.Send
to
.Close olSave
once more, thank you!
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?
Regards
Hi there, this weekend is nice in support of me, because this point in time i am
reading this great educational article here at my home.