How to automatically print sent messages

Last reviewed on August 28, 2013

An Outlook user had a request to print sent messages automatically:

I want to send and then print the sent emails with a click of the button.

He had some VBA code, however it wasn't working for him due to a couple of errors. I helped him fix it and this is what he ended up with. If you just want to create a button for a category (instead of using the Category picker), you only need the SendPrint() code.

Note that the category name is case-sensitive.

To use, set your macro security to low. Add this code to ThisOutlookSession, create a ribbon or QAT button for the SendPrint macro. To test it without restarting Outlook, click in Application_Startup and then click Run. For more information, see How to use Outlook's VBA Editor

After composing your message, click your button to send and print the message instead of using the Send button.

Send and Print

Option Explicit
 
Private WithEvents Items As Outlook.Items
  
Private Sub Application_Startup()
Set Items = Session.GetDefaultFolder(olFolderSentMail).Items
  
End Sub
 
Private Sub Items_ItemAdd(ByVal Item As Object)
 
   If Item.Categories = "Print" Then
      Item.PrintOut
   End If
  
End Sub


Sub SendPrint()
Dim obj
Set obj = ActiveInspector.CurrentItem
   obj.Categories = "Print"
   obj.Send
End Sub

Remove category and print

To remove the category from the item after its printed (so you know which messages were printed), replace the ItemAdd macro above with this code.

Private Sub Items_ItemAdd(ByVal Item As Object)
   If Item.Categories = "Print" Then
      Item.Categories = ""
      Item.PrintOut
   End If
  
End Sub

Written by

Diane Poremsky
A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Please post long or more complicated questions at Outlookforums.

Leave a Reply

If the Post Coment button disappears, press your Tab key.