Solved

Outlook 2007 - Export

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

User Beware!  This is a rather permanent solution to removing your email from an exchange server.  The only way to truly go back is to have your exchange administrator restore your mailbox from backups.  This is usually the option of last resort.  A…
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…
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…

743 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

16 Experts available now in Live!

Get 1:1 Help Now