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
Solved

Outlook 2007 - Export

Posted on 2011-02-10
6
375 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

This collection of functions covers all the normal rounding methods of just about any numeric value.
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
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…

856 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