More Outlook Resource Sites

Microsoft Developer Network (MSDN)

FAQs and other general resources

Printing Custom Outlook Forms and Reports

Microsoft Word and Microsoft Excel are probably the best print engines for custom printing of Outlook forms and folder data. In Word, create a template with form fields and bookmarks, then use VBScript or VBA code to push the Outlook data into the template. You can do the same thing with Excel using range names.

My book --  Microsoft Outlook Programming: Jumpstart for Administrators, Developers, and Power Users -- devotes a full chapter to printing forms and reports with folder views, Microsoft Excel and Microsoft Word. You can download the source code, which includes several sample Excel and Word printing projects, using the the Get Sue's Code link at the bottom of any page.

Reports without code

Method 1: Copy and paste to Excel

  1. Arrange the columns in a table view to show the fields you're interested in, in the order you want.
  2. Choose Edit | Select All, then Edit | Copy.
  3. Switch to an Excel worksheet, then choose Edit | Paste.

Once you have the data in Excel, you can do subtotals, totals, etc. with it and print the worksheet. You can also use this method to export custom fields to Excel.

Method 2: Saved Search

  1. Choose Tools | Advanced Find, set up your search, and run it. Note that you can search across multiple folders in your Exchange mailbox or a Personal Folders .pst file.
  2. Arrange the columns in a table view to show the fields you're interested in, in the order you want, with the column widths you need to display the full data in each field.
  3. Choose File | Print to print the results.
  4. Choose File | Save Search to save the search as an .oss file.

If you can send the .oss file to other users, they can run the search, then print the results, too.

Many thanks to Scott Perley on the outlook-dev discussion list for this method!

Method 3: Mail merge to Word

This method works only with contacts, but it supports any custom fields visible in the folder. The secret is to start the merge from the Outlook contacts folder with the Tools | Mail Merge command and choose to merge all fields in the folder. From there, just construct your document as you normally would. The folder's custom fields will be visible in the fields list. See: To start a Word letter from a Microsoft Outlook contact

WYSIWYG form printing

XPrint

XPrint is a free ActiveX control and add-in from Microsoft for printing exactly what you see on an Outlook form, buttons and all. It has enough serious limitations (see below) that I don't recommend it. If you choose to use it, everyone in your organization who needs WYSIWYG printing will need to install it, which will place an .ocx control and help file in the Office\Addins folder. It also adds XPrint Addin to the Add-in Manager; this add-in replaces the normal Print dialog for customized Message and Post forms, allowing you to get some WYSIWYG printing for those without adding the control to the form.

The add-in prints all customized pages. The ActiveX control prints only the page on which you place it. If you can't add the XPrint ActiveX control to the control toolbox, try running Regsvr32 to register it: 

regsvr32 "c:\program files\microsoft office\office\addins\xprint.ocx"

XPrint cannot print the Body (message body), To, Cc or Bcc fields, though the first article below offers a workaround. See:

Custom Word Templates and Code

For best results, automate Word, pushing data into either a blank document or a document created from a template, filling in form fields or insert text at bookmarks. Using a template lets you divide up the work: Someone else can lay out and format the template. You will find examples for this method in my book and among the samples below.

TIP: If you use the Word form field method, don't use a form field for the body of a message or for any other large field or field containing carriage return/line feeds. Instead use a bookmark, with a syntax like this:

objDoc.Bookmarks("Other").Range.InsertAfter Item.Body

this Range.InsertAfter technique any time you need to insert data that contains carriage returns. Here's another example, inserting the list of attachments from a message (Item) into a Word document (objDoc) at a bookmark named Attachment_List:

strAtts = ""
For Each att in Item.Attachments
       strAtts = strAtts & att.DisplayName & vbCrLf
Next
objDoc.Bookmarks("Attachment_List").Range.InsertAfter strAtts

Printing an HTML Message or Post

An all-Outlook method is to create a new message or post and set its HTMLBody property to a fully tagged HTML string containing the information you want to print out. The sample at  Sending a mail message with today's appointments shows how to construct such a message from a bunch of appointments. Instead of using .Display to display the message, you could use .PrintOut to print it out. Section 22.1.4 in my book describes this method in detail.

Samples

Chapter 24 in Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators and Chapter 22 in Sue Mosher's earlieer book -- Microsoft Outlook Programming: Jumpstart for Administrators, Developers, and Power Users -- is all about custom printing. You can download the samples using the Get the Code link at the top of any page.

Yearly Calendar for Outlook

Outlook VBA macro to display appointments over a period of several months using an HTML file

Easy Task Reports with Outlook and WordProcessingML

Export  Outlook 2003 data as XML and then use Word's XML features and XSL to create a menu of different reports. Sample code available.

Print custom fields for a specific contact

Using Word bookmarks

Word Calendar templates

Three custom Word templates to print data from Outlook calendar folders. Good examples of how to loop through all items in an Outlook folder, build Word tables, color-code by category, etc. 

Time & Expense Billing: Part I and Part II

Sample application by Helen Feddema that uses Word to print time reports derived from Outlook journal items. Get the updated sample code.

Address Export Solution

Mail merge via Word to print address lists

Print appointment

With attendee status

Printing Forms inside Outlook

Builds a web page from a custom form's layout and prints that web page

Query Outlook Custom Form Properties from Excel

Extracts property values into Excel rows and columns

Tools

Blueprint for Outlook

Uses HTML templates to print custom Outlook forms. Also allows users to print only selected pages and add custom headers and footers to printouts.

Crystal Reports

General reporting tool that should be able to handle Outlook data including custom properties.

Outlook Extensions Library

Multi-purpose add-in for developers. Supports many useful features, including WYSIWG printing. 

More information