Print out ALL emails

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
21,834
Office Version
  1. 365
  2. 2019
  3. 2013
  4. 2007
Platform
  1. Windows
Hi all
I have a client that wants to print ALL EMails from his Inbox once each day.
He wants to do this from Excel and Outlook will be open at all times
Has anyone done anything like this.
I'd appreciate any code, or assistance that can be provided
I'd be more than happy to save to a folder, then print them from there....if that's easier
Regards
Michael
 
Last edited:

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Hi,

This should be a good starting point.

You need to set up a reference to Microsoft Outlook 15.0 Object Library and place the code below into an Excel macro Module.

The macro goes to the InBox and loops round the items in there. It selects the mail items with a received date of today then it prints them.

Code:
' Requires Tools-->References-->Microsoft Outlook 15.0 Object Library
Sub PrintInbox()

    Dim olApp As Outlook.Application
    Dim olNs As Outlook.Namespace
    Dim olFldr As Outlook.MAPIFolder
    Dim olItem As Object
    Dim olMailItem As Outlook.MailItem
    
    Set olApp = CreateObject("Outlook.Application")
    Set olNs = olApp.GetNamespace("MAPI")
    Set olFldr = olNs.GetDefaultFolder(olFolderInbox)
    
    For Each olItem In olFldr.Items
        If olItem.Class = olMail Then
            Set olMailItem = olItem
            If olMailItem.ReceivedTime > Date Then olMailItem.PrintOut
        End If
    Next olItem
    
End Sub
 
Upvote 0
Thanks
Really appreciate the response, I think this should do the trick.
Much appreciated....(y)
 
Upvote 0
No problem.

I Googled email printing before I started just in case something was out there that I should know. All I got were lots of references involving Hillary Clinton!
This is not for Hillary, is it? :)

Regards,
 
Upvote 0
:LOL:..:LOL:
I can just imagine the Secret Service saying to each other....."eh boys, how we gonna do this ???.....Dunno lets contact Mr excel"....:ROFLMAO::ROFLMAO:
 
Upvote 0

Forum statistics

Threads
1,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top