Solved

Outlook 2007 - Export

Posted on 2011-02-10
6
365 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
  • 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
The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

 
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

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
Having trouble getting your hands on Dynamics 365 Field Service or Project Service trial? Worry No More!!!
This video shows and describes the main difference between both orientations in Microsoft Word. Viewers will understand when to use each orientation and how to get the most out of them.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

815 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now