Solved

Outlook 2007 = exporting a single email contents to Word 2007

Posted on 2013-11-23
12
398 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 

Author Comment

by:jegajothy
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
a walking programming genius.  Thank u for the code.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Learn more about how the humble email signature can be used as more than just an electronic business card. When used correctly, a signature can easily be tailored for different purposes by different departments within an organization.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
This video teaches the viewer how to align pictures around text while keeping the text properly aligned in the document.
In a previous video Micro Tutorial here at Experts Exchange (http://www.experts-exchange.com/videos/1358/How-to-get-a-free-trial-of-Office-365-with-the-Office-2016-desktop-applications.html), I explained how to get a free, one-month trial of Office …

762 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

14 Experts available now in Live!

Get 1:1 Help Now