How to save multiple selected emails as MSG files in bulk in Outlook?
It is easy to save an email as a MSG file in Outlook. How can you save multiple selected emails as individual MSG files in bulk in Outlook? This article will show you a method to achieve it.
The following VBA code can help you save multiple selected emails as individual MSG files in bulk in Outlook. Please do as follows.
1. Select the emails you want to save as MSG files. Then press the Alt + F11 keys simultaneously to open the Microsoft Visual Basic for Applications window.
2. In the Microsoft Visual Basic for Applications window, click Insert > Module, and then copy below VBA code into the Module window.
VBA code: Save multiple selected emails as individual MSG files in Outlook
Public Sub SaveMessageAsMsg() 'Update by Extendoffice 2018/3/5 Dim xMail As Outlook.MailItem Dim xObjItem As Object Dim xPath As String Dim xDtDate As Date Dim xName, xFileName As String On Error Resume Next Set xShell = CreateObject("Shell.Application") Set xFolder = xShell.BrowseForFolder(0, "Select a folder:", 0, strStartingFolder) If Not TypeName(xFolder) = "Nothing" Then Set xFolderItem = xFolder.self xFileName = xFolderItem.Path & "\" Else xFileName = "" Exit Sub End If For Each xObjItem In Outlook.ActiveExplorer.Selection If xObjItem.Class = olMail Then Set xMail = xObjItem xName = xMail.Subject xDtDate = xMail.ReceivedTime xName = Format(xDtDate, "yyyymmdd", vbUseSystemDayOfWeek, _ vbUseSystem) & Format(xDtDate, "-hhnnss", _ vbUseSystemDayOfWeek, vbUseSystem) & "-" & xName & ".msg" xPath = xFileName + xName xMail.SaveAs xPath, olMSG End If Next End Sub
3. Press the F5 key to run the code.
4. In the Browse For Folder dialog box, please specify a folder to save the MSG files and then click the OK button. See screenshot:
Now all selected emails are saved as individual MSG files as below screenshot shown.
- Auto CC/BCC by rules when sending email; Auto Forward Multiple Emails by custom; Auto Reply without exchange server, and more automatic features...
- BCC Warning - show message when you try to reply all if your mail address is in the BCC list; Remind When Missing Attachments, and more remind features...
- Reply (All) With All Attachments in the mail conversation; Reply Many Emails in seconds; Auto Add Greeting when reply; Add Date into subject...
- Attachment Tools: Manage All Attachments in All Mails, Auto Detach, Compress All, Rename All, Save All... Quick Report, Count Selected Mails...
- Powerful Junk Emails by custom; Remove Duplicate Mails and Contacts... Enable you to do smarter, faster and better in Outlook.
You are guest
or post as a guest, but your post won't be published automatically.
- To post as a guest, your comment is unpublished.· 1 years agoHi, i am new to macro. i am looking for a macro that allows me to save the filename, not by subject or time. But by the reference # found inside the email body. This macro works well when i save multiple emails into my folder. But as i want each email to be saved using the reference #, would you have a macro for it? The reference # is found on the 6th row of the emails body (REF : WL344ET2), that i received everyday. Appreciate if anyone can help on this and thank you in advance.
- To post as a guest, your comment is unpublished.· 1 years agoWhen there is a ":" in the subject, this code cannot copy the whole subject to be the name of the saved message, is there any way to solve this problem?
- To post as a guest, your comment is unpublished.· 1 years agochange line 21 to xName="". The saved message filname will not include the subject anymore.
- To post as a guest, your comment is unpublished.· 10 months agoA better way is to always replace ":" with blanks adding this line under xName = xMail.Subject
xName = Replace(xName, ":", "")