United States*
Microsoft.com Home|Site Map
Microsoft*
Search Microsoft.com for:
Help and Support 
|Select a Product|Search (KB)

Outlook 2002 doesn't print forms as expected

Article ID:290775
Last Review:August 2, 2004
Revision:1.0
This article was previously published under Q290775
For a Microsoft Outlook 98 version of this article, see 194802.
For a Microsoft Outlook 2000 version of this article, see 230512.

SYMPTOMS

You want to print an Outlook form in a specific format, but there doesn't appear to be a way to do this.

CAUSE

Outlook can only print forms with the options that are available in the Print window. While you can customize the Print Style settings using the various options Outlook provides in its user interface, you cannot alter the basic way that Outlook prints by using custom Print Styles.

For programmers, the Outlook object model does not provide additional ways of directly changing the print format of a form.

MORE INFORMATION

IMPORTANT: This article requires knowledge of creating custom Outlook forms and using Visual Basic Scripting Edition (VBSCript). It provides a basic example of how to begin implementing a solution and will most likely require considerable customization to suit a specific need. If you do not have a background in programming and implementing a custom solution, you may wish to seek the assistance of a Solution Provider. For additional information about how to contact a Microsoft Solution Provider, click the article number below to view the article in the Microsoft Knowledge Base:
287531 OL2002: Resources for Custom Forms and Programming
The following methods provide an overview of possible approaches you can use to solve this problem. These approaches should be evaluated based on factors such as:
Whether you are using a custom form or would consider using one to enable additional functionality.
Whether you need a custom print format or just want to print the form exactly as it appears on the screen.
Whether you have an adequate programming background. If you are familiar with Visual Basic-type programming, you could develop a solution. If not, you may want to obtain the services of a developer who can provide the solution.

Method 1: Use ALT+PRINT SCREEN

If you want to print a form as it appears on the screen without developing a solution, you can use the ALT+PRINT SCREEN key sequence to copy the image of the form to the clipboard. You can then paste the contents of the clipboard into another program and print it.

To have Microsoft Word print an image of the form, follow these steps:
1.With the Outlook form displayed, press ALT+PRINT SCREEN. You will not see or hear anything happen.
2.Switch to or start Word.
3.Make sure you have a new document open. You may want to reduce the margins of the document to allow more room for the image to fit on the page.
4.On the Edit menu, click Paste.
5.Resize the image as appropriate:
a. Click the image once to select it.
b. On the Format menu, click Picture.
c. Click the Size page of Format Picture.
d. On the Size tab, set the Height and Width of the picture.
6.To print the document, on the File menu, click Print.

Method 2: Use VBScript To Automate the ALT+PRINT SCREEN Method

Microsoft provides programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes that you are familiar with the programming language being demonstrated and the tools used to create and debug procedures. Microsoft support professionals can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific needs. If you have limited programming experience, you may want to contact a Microsoft Certified Partner or the Microsoft fee-based consulting line at (800) 936-5200. For more information about Microsoft Certified Partners, please visit the following Microsoft Web site: For more information about the support options that are available and about how to contact Microsoft, visit the following Microsoft Web site: If you want to print a form as it appears on the screen and would consider using a custom Outlook form that contains custom programming code, you can use Visual Basic Scripting Edition (VBScript) to automate Method 1. The end result will be that you can press ALT+PRINT SCREEN and then click a button on the form to print it. You must add a Print button to the form to do this.

To create the custom form, follow these steps:
1.On the Tools menu, point to Forms and then click Design This Form. Click the (P.2) page of the form.
2.On the Form menu, click Control Toolbox. Drag a CommandButton control onto the P.2 page of the form. Right-click the control and then click Properties. On the Display tab, set the Name to cmdPrint and the Caption to Print. Click OK and then close the Control ToolBox.
3.On the Form menu, click View Code. Enter the following VBScript code into the Script Editor and then close the Script Editor:
Sub cmdPrint_Click()
   Set oWordApp = CreateObject("Word.Application")
   If oWordApp Is Nothing Then
      MsgBox "Couldn't start Word."
   Else
      Dim oWordApp
      Dim oWordDoc
      Dim oBMs
      Dim bolPrintBackground

      ' Open a new document
      Set oDoc = oWordApp.Documents.Add

      ' Set a page setup object variable
      Set oPS = oDoc.PageSetup

      ' Reduce the margins to .5" (36 points)
      oPS.TopMargin = 36
      oPS.BottomMargin = 36
      oPS.LeftMargin = 36
      oPS.RightMargin = 36

      ' Paste in the screen shot
      oWordApp.Selection.Paste

      ' Center the screen shot
      Const wdAlignParagraphCenter = 1
      oDoc.Paragraphs(1).Alignment = wdAlignParagraphCenter

      ' Get the current Word setting for background printing
      bolPrintBackground = oWordApp.Options.PrintBackground

      ' Turn background printing off
      oWordApp.Options.PrintBackground = False

      ' Print the Word document
      oDoc.PrintOut

      ' Restore previous setting
      oWordApp.Options.PrintBackground = bolPrintBackground

      ' Close and don't save changes to the document
      Const wdDoNotSaveChanges = 0
      oDoc.Close wdDoNotSaveChanges

      ' Close the Word instance
      oWordApp.Quit

      ' Clean up
      Set oPS = Nothing
      Set oDoc = Nothing
      Set oWordApp = Nothing
   End If
End Sub
					
4.On the Tools menu, point to Forms and then click Publish Form. The default is to store the Contact form in your Contacts folder. Type Print Test as the Display Name and then click Publish.
5.Close and do not save changes to the form.
To test the form, follow these steps:
1.On the Actions menu, click New Print Test.
2.Press ALT+PRINT SCREEN.
3.Click the P.2 page of the form and click Print.

Method 3: Generate a Custom Report

If you want to create a custom printout, or avoid having users press ALT+PRINT SCREEN, you can create a Word template that contains form fields and then have Outlook automatically transfer fields from an Outlook item into the template. With this method, Word will handle all of the formatting and printing.

NOTE: You may want to use another program, such as Microsoft Excel, depending on the required format of the printout and your programming ability.

Follow these steps to create the sample Word template:
1.Open a new document in Word.
2.On the View menu, point to Toolbars and then click Forms.
3.Click the Text Form Field button on the Forms toolbar to insert a form field. Press ENTER twice and then click the Text Form Field button again to insert a second form field. Note that the form fields have default bookmark names of Text1 and Text2.
4.Click the Protect Form button on the Forms toolbar to protect the template.
5.On the File menu, click Save As. Change the Save As Type setting to Document Template, change the Save In setting to (C:), type MyForm as the name of the template and then click Save.
6.Close the template.
To create the Outlook form, follow these steps:
1.Open a new Contact form. On the Tools menu, click Forms and then click Design This Form. Click the (P.2) page of the form.
2.On the Form menu, click Control Toolbox. Drag a CommandButton control onto the P.2 page of the form. Right-click the control and then click Properties. On the Display tab, set the Name to cmdPrint and the Caption to Print. Click OK and then close the Control ToolBox.
3.On the Form menu, click View Code. Enter the following VBScript code into the Script Editor and then close the Script Editor:
Sub cmdPrint_Click()
   Set oWordApp = CreateObject("Word.Application")
   If oWordApp Is Nothing Then
      MsgBox "Couldn't start Word."
   Else
      Dim oWordApp
      Dim oWordDoc
      Dim bolPrintBackground

      ' Open a new document
      Set oDoc = oWordApp.Documents.Add("C:\MyForm.dot")

      ' Set the first bookmark to the contact's full name
      oDoc.FormFields("Text1").Result = CStr(Item.FullName)

      ' Set the second bookmark to the contact's birthday
      oDoc.FormFields("Text2").Result = CStr(Item.Birthday)

      ' If the form contains user-defined fields, you can use
      ' the following syntax to transfer the contents of a
      ' user-defined field (FieldName) to Word:
      ' strMyField = Item.UserProperties.Find("FieldName")
      ' oDoc.FormFields("Text3").Result = strMyField

      ' Get the current Word setting for background printing
      bolPrintBackground = oWordApp.Options.PrintBackground

      ' Turn background printing off
      oWordApp.Options.PrintBackground = False

      ' Print the Word document
      oDoc.PrintOut

      ' Restore previous setting
      oWordApp.Options.PrintBackground = bolPrintBackground

      ' Close and don't save changes to the document
      Const wdDoNotSaveChanges = 0
      oDoc.Close wdDoNotSaveChanges

      ' Close the Word instance
      oWordApp.Quit

      ' Clean up
      Set oDoc = Nothing
      Set oWordApp = Nothing
   End If
End Sub
					
4.On the Tools menu, point to Forms and then click Publish Form. The default is to store the Contact form in your Contacts folder. Type Send Fields as the Display Name and then click Publish.
5.Close and do not save changes to the form just created.
To test the form, follow these steps:
1.On the Actions menu, click New Send Fields.
2.Enter a full name for the contact and on the Details page of the form, enter a birthday.
3.Click the P.2 page of the form and click Print.
The contact's full name and birthday will be printed. You can customize the Word template to suit your needs.

REFERENCES

For additional information about available resources and answersto commonly asked questions about Microsoft Outlook solutions, click the article number below to view the article in the Microsoft Knowledge Base:
287530 OL2002: Questions About Custom Forms and Outlook Solutions

APPLIES TO
Microsoft Outlook 2002 Standard Edition
Keywords: 
kbprint kbforms kbprb KB290775

Article Translations

 

Related Support Centers

Microsoft Outlook 2002

Other Support Options

Contact Microsoft
Phone Numbers, Support Options and Pricing, Online Help, and more.
Customer Service
For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
Newsgroups
Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.

©2005 Microsoft Corporation. All rights reserved. Terms of Use |Trademarks |Privacy Statement