Solved

Outlook 2007 - Export

Posted on 2011-02-10
6
390 Views
Last Modified: 2012-05-11
My OS is windows 7.  Is it possible to export the emails in a folder, say to Word, i.e. each email will be a separate file of its own.  It can output to Excel or Access but the result is very hard to read.  Thank u.
0
Comment
Question by:jegajothy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 34873010
Hi, jegajothy.

This script will export all the messages in the current Outlook folder to the file system, writing each in Word format.  Follow these instructions to add the code to Outlook.

1.  Start Outlook
2.  Click Tools > Macro > Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

To use this macro

1.  Select the Outlook folder you want to export from
2.  Run the macro
Sub ExportMessagesToWord()
    '--- On the next line edit the path to the folder the messages will be saved to ---'
    Const EXPORT_FOLDER = "C:\eeTesting\ExportAll\"
    Dim olkMsg As Outlook.MailItem, objFSO As Object, strFilename As String, strTemp As String, intCnt As Integer
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    For Each olkMsg In Application.ActiveExplorer.CurrentFolder.Items
        strFilename = RemoveIllegalCharacters(olkMsg.Subject)
        strTemp = EXPORT_FOLDER & strFilename & ".doc"
        intCnt = 1
        Do Until Not objFSO.FileExists(strTemp)
            strTemp = EXPORT_FOLDER & strFilename & " (Copy " & intCnt & ").doc"
            intCnt = intCnt + 1
        Loop
        olkMsg.SaveAs strTemp, olDoc
    Next
    Set objFSO = Nothing
    Set olkMsg = Nothing
    msgbox "Completed export.", vbInformation + vbOKOnly, "Export Message to Word Format"
End Sub

Open in new window

0
 
LVL 50

Expert Comment

by:jcimarron
ID: 34874320
0
 

Author Comment

by:jegajothy
ID: 34874692
In respose to BlueDevinFan, I think u would need to also code the following :
RemoveIllegalCharacters
Because when I ran the macro it gave me that the Function was not defined.
Thank u for a brillant idea which I can use. Gracias. Thank u.
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 76

Expert Comment

by:David Lee
ID: 34874728
Oops!  Sorry, this is what happens when you get older and more forgetful.
Function RemoveIllegalCharacters(strValue As String) As String
    ' Purpose: Remove characters that cannot be in a filename from a string.'
    ' Written: 4/24/2009'
    ' Author:  BlueDevilFan'
    ' Outlook: All versions'
    RemoveIllegalCharacters = strValue
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "<", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ">", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, ":", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, Chr(34), "'")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "/", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "\", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "|", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "?", "")
    RemoveIllegalCharacters = Replace(RemoveIllegalCharacters, "*", "")
End Function

Open in new window

0
 

Author Closing Comment

by:jegajothy
ID: 34875043
U sure earn the status of a Guru.  Thank u
0
 
LVL 76

Expert Comment

by:David Lee
ID: 34876023
Thank, and you're welcome!
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question