Exporting E-Mails from Outlook to msg-files is easily done by marking and then drag-and-dropping the E-Mails from the Outlook window to the Windows file explorer. However, this has several disadvantages for a large number of E-Mails:
- The process is very slow and no indication of the status is given.
- If the subject names of E-Mails have characters in them that are not valid in file names, the procedure fails.
- Sometimes, this will still fail unexpectedly.
- The files are named by the E-Mail subject without a preceding date/time information, which complicates the overview.
The macro contained in this repo exports all E-Mails from a defined Outlook folder in a stable manner.
Before using this code, please ensure the following:
- All items in the folder containing the E-Mails must be available offline. If they are not:
- Go to File -> Account Settings -> Account Settings -> double click on your account's name -> make all emails available offline
- Restart Outlook
- Go to the folder -> Send/Receive -> Update folder
- If you are using a digital certificate, please log in first.
Follow these steps to run the macro:
- Open the VBA environment via
Alt+F11 - Import the macro: File -> Import file -> choose
ExportEmailToMsg.bas - Open the immediate command window to view the status via
CTRL+G - Run the macro via
F5 - First, you will be asked to select the Outlook folder to export E-Mails from. Then, you'll need to select a folder to save the msg-files to.
Thanks to the authors and commentators on the following sites, who have inspired this code: