Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 02-12-2016, 12:43 AM
gmayor's Avatar
gmayor gmayor is offline How to print a "list only" of ALL the emails in my Inbox and Sent Box in Outlook Windows 10 How to print a "list only" of ALL the emails in my Inbox and Sent Box in Outlook Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,142
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

I think the following Outlook macro may help, but if you require the message bodies that would produce a humungous document with thousands of records.
Code:
Option Explicit
Sub ListMessages()
Dim wdApp As Object
Dim wdDoc As Object
Dim oTable As Object
Dim bStarted As Boolean
Dim oRng As Object
Dim olFolder As Folder
Dim olItem As MailItem
    Set olFolder = Application.Session.PickFolder
    On Error Resume Next
    Set wdApp = GetObject(, "Word.Application")
    If Err Then
        Set wdApp = CreateObject("Word.Application")
        bStarted = True
    End If
    On Error GoTo err_Handler
    Set wdDoc = wdApp.Documents.Add
    Set oTable = wdDoc.Tables.Add(wdDoc.Range, 1, 2)
    Set oRng = oTable.Rows.Last.Cells(1).Range
    oRng.End = oRng.End - 1
    oRng.Text = "Message"
    Set oRng = oTable.Rows.Last.Cells(2).Range
    oRng.End = oRng.End - 1
    oRng.Text = "Date"
    wdApp.Visible = True
    wdApp.Activate
    Set oRng = wdDoc.Range
    For Each olItem In olFolder.Items
        oTable.Rows.Add
        Set oRng = oTable.Rows.Last.Cells(1).Range
        oRng.End = oRng.End - 1
        oRng.Text = olItem.Subject
        Set oRng = oTable.Rows.Last.Cells(2).Range
        oRng.End = oRng.End - 1
        oRng.Text = Format(olItem.ReceivedTime, "dd/mm/yyyy")
    Next olItem
lbl_Exit:
    If bStarted = True Then
        wdApp.Quit
    End If
    Set wdDoc = Nothing
    Set wdApp = Nothing
    Exit Sub
err_Handler:
    MsgBox Err.Number & vbCr & Err.Description
    Err.Clear
    GoTo lbl_Exit
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Outlook 2007 IMAP "Inbox" not receiving new emails. gcnivas Outlook 0 05-26-2015 02:07 PM
How to print a "list only" of ALL the emails in my Inbox and Sent Box in Outlook How to choose a "List" for certain "Heading" from "Modify" tool? Jamal NUMAN Word 2 07-03-2011 03:11 AM
direct incoming email to "outlook" folder inbox John Ames Outlook 8 06-25-2011 02:51 PM
outlook "Unread Email" folder automaticaly reads then dissapears emails michaelrj9 Office 0 08-20-2010 03:59 PM
Outlook Today's "Inbox" and Showing New Mail for E my02wg Outlook 0 03-19-2006 06:36 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:53 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft