Solved

Outlook 2007 - Export

Posted on 2011-02-10
6
396 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
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!

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

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.
Outlook Free & Paid Tools
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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…

691 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