Solved

Outlook 2007 = exporting a single email contents to Word 2007

Posted on 2013-11-23
12
402 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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 
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
 

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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

Suggested Solutions

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Read this checklist to learn more about the 15 things you should never include in an email signature.
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
CodeTwo Sync for iCloud (http://www.codetwo.com/sync-for-icloud?sts=6554) automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…

773 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