Solved

Outlook 2007 = exporting a single email contents to Word 2007

Posted on 2013-11-23
12
400 Views
Last Modified: 2013-11-25
My OS is win 7 prof 64 bit and I use Office 2007.  I am trying to export the contents of a single email to Outlook.  Can an expert please walk me thru how to do this? Thank u.
0
Comment
Question by:jegajothy
  • 6
  • 6
12 Comments
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39672251
Can you clarify … you are trying to exports the contents of a single email (in outlook presumably) to Outlook?

Chris
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39672252
Sorry the title gives the game away … what from the email do you want to export and how should it appear in word?

Chris
0
 

Author Comment

by:jegajothy
ID: 39672666
in response to Chris I want to export from Outlook 2007.  Whenever one clicks on an email and reads it.  But I want to save the contents of this Outlook 2007 email that I just read to a Word 2007 document, just all the contents, either from the Sender's information to the end of that message, or maybe just the contents only.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39672677
The scope of what is written to word we can play with … the main concern I would have the now is triggering the macro … calling it from the run menu option is the easiest i.e. a named macro that does what you ask.

Would that work for you?

Chris
0
 

Author Comment

by:jegajothy
ID: 39672679
in response to Chris,
I think a macro will work very well.  Please give me the steps to stick it wherever I am supposed to glue it.  Thank u very much for your response.
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39672681
Place the following into an outlook code module:

Sub Q_28302258_1()
Dim wrdApp As Object
Dim doc As Object
Dim mai As MailItem
Dim GetCurrentItem As Object

    Select Case TypeName(Application.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
    End Select
    
    If TypeName(GetCurrentItem) = "MailItem" Then
        Set mai = GetCurrentItem
        Set wrdApp = CreateObject("word.application")
        Set doc = wrdApp.documents.Add
        wrdApp.Selection.typetext mai.Body
        wrdApp.Visible = True
    Else
        Exit Sub
    End If
    
End Sub

Open in new window


Chris
0
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 

Author Comment

by:jegajothy
ID: 39672743
In response to Chris, thank u for your code, I have renamed the sub to : OuttoWord, but when I ran it, I got the error as in the attached file.  Maybe I have not done any prerequisites tweaking.  Thank u.
outlook-2007-macro-error.docx
0
 
LVL 59

Expert Comment

by:Chris Bottomley
ID: 39672846
Typo

Sub Q_28302258_1()
Dim wrdApp As Object
Dim doc As Object
Dim mai As MailItem
Dim GetCurrentItem As Object

    Select Case TypeName(Application.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = Application.ActiveInspector.CurrentItem
    End Select
    
    If TypeName(GetCurrentItem) = "MailItem" Then
        Set mai = GetCurrentItem
        Set wrdApp = CreateObject("word.application")
        Set doc = wrdApp.documents.Add
        wrdApp.Selection.typetext mai.Body
        wrdApp.Visible = True
    Else
        Exit Sub
    End If
    
End Sub

Open in new window


Tested the explorer scenario but skipped over the inspector session - I guess when you got the error you had an email open - assuming so this should resolve that issue.

Chris
0
 

Author Comment

by:jegajothy
ID: 39674643
In response to Chris, I am afraid that nothing happened when I ran the code with an email open.
0
 
LVL 59

Accepted Solution

by:
Chris Bottomley earned 500 total points
ID: 39674678
There are 'classifications' of outlook objects.  A mailitem is one specific example, I have opened the script up to support any outlook object ... see if this works now.

Sub Q_28302258_2()
Dim wrdApp As Object
Dim doc As Object
Dim GetCurrentItem As Object

    Select Case TypeName(Application.ActiveWindow)
        Case "Explorer"
            Set GetCurrentItem = Application.ActiveExplorer.Selection.Item(1)
        Case "Inspector"
            Set GetCurrentItem = Application.ActiveInspector.CurrentItem
    End Select
    
       Set wrdApp = CreateObject("word.application")
        Set doc = wrdApp.documents.Add
        wrdApp.Selection.typetext GetCurrentItem.Body
        wrdApp.Visible = True
   
End Sub

Open in new window


Chris
0
 

Author Comment

by:jegajothy
ID: 39674853
Hi Chris,
I salute u for your technical knowledge especially in the programming field.  The code worked, it opened word and created a document.  Graphics in the email was rendered a a hyperlink to the web site.
Thank u and well done.
with best wishes and happy holidays.
0
 

Author Closing Comment

by:jegajothy
ID: 39674855
a walking programming genius.  Thank u for the code.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Resolve DNS query failed errors for Exchange
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
This video walks the viewer through the process of creating envelopes and labels, with multiple names and addresses. Navigate to the “Start Mail Merge” button in the Mailings tab: Follow the step-by-step process until asked to find the address doc…
This video walks the viewer through the process of creating Hyperlinks for the web and other documents. Select the "Insert" tab: Click "Hyperlink":  Type "http://" followed by a web address to reference a website or navigate to a document to ref…

911 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

18 Experts available now in Live!

Get 1:1 Help Now