Create a custom printout in Outlook

Last reviewed on April 29, 2014   —  No comments yet

An Outlook user wanted to print only the custom fields in a Task:

Is there any way to hide the default Task fields on a print out? All of the fields appear when I print the task and I only need specific fields.

The default task printout

Although you can't edit the print templates, you can use a macro to create a draft message and print it.

The following code puts together a string containing some of the Task fields of a selected task, including two custom fields, and adds them to a message body. It prints the message then deletes the draft message.

Create a custom printout

Custom fields are referenced using .UserProperties("fieldname"). Format the date field as "May 3 2014" using Format(olTask.StartDate, "MMM d yyyy") .

To use, select one or more tasks, then run the macro. A message will be created and printed for each task in the selection.

This method is not limited only to tasks; you can use it with any Outlook item type with just a little tweaking of the code to change the fields and item type.

Sub PrintTasks()
    Dim olTask As Outlook.TaskItem, olMsg As Outlook.MailItem
    Dim strBody As String
    
    For Each olTask In Application.ActiveExplorer.Selection
 
'put your fields together here 
     strBody = olTask.Subject & vbCrLf & olTask.Body & vbCrLf
     strBody = strBody & olTask.StartDate & vbCrLf & olTask.UserProperties("Contact Name") & vbCrLf & olTask.UserProperties("Email Address")

        Set olMsg = Application.CreateItem(olMailItem)
        With olMsg
            .BodyFormat = olFormatPlain
            .Body = strBody
           ' .Display
            .PrintOut ' print automatically
            .Close olDiscard
        End With
    Next
    
    Set olMsg = Nothing

End Sub

How to use macros

First: You will need macro security set to low during testing.

To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.

After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Open the VBA Editor by pressing Alt+F11 on your keyboard.

To put the code in a module:

  1. Right click on Project1 and choose Insert > Module
  2. Copy and paste the macro into the new module.

More information as well as screenshots are at How to use the VBA Editor

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.