How to Auto Print the First Page of Important Incoming Emails in Your Outlook

Some users would like to let Outlook auto print the important incoming emails. Also, if such an email is too long, for not wasting papers, Outlook will only print the first page. Now, in this article, we will expose how to realize it programmatically.

To manually print the first page of a mail is pretty easy. You can just change the print options before printing. However, if you hope that Outlook can auto identify the length of email and auto print the first page of a very long email, you have to seek other means, such as the following one.

Auto Print the First Page of Important Incoming Emails in Your Outlook

Auto Print the First Page of Important Incoming Emails

  1. To begin with, you need to launch your Outlook application as normal.
  2. Then in the main Outlook window, you need to press “Alt + F11” keys.
  3. Subsequently, you will access VBA editor in success.
  4. In this new window, you should open an empty module, in which you ought to copy the following VBA code into this module.
Sub PrintFirstPage_ImportantIncomingEmails(objMail As Outlook.MailItem)
    Dim objWordApp As Word.Application
    Dim objTempWordDocument As Word.Document
    Dim objMailDocument As Word.Document
    Dim lPageCount As Long
 
    objMail.Display
    Set objMailDocument = objMail.GetInspector.WordEditor
    objMailDocument.Range.Copy
    
    Set objWordApp = CreateObject("Word.Application")
    Set objTempWordDocument = objWordApp.Documents.Add
    objWordApp.Visible = True
    objTempWordDocument.Activate
 
    objTempWordDocument.Range.Paste
 
    lPageCount = objTempWordDocument.ComputeStatistics(wdStatisticPages)
 
    'If the email takes up more than one page
    If lPageCount > 1 Then
       'Only print the first page
       objTempWordDocument.PrintOut Range:=wdPrintFromTo, From:="1", To:="1"
    Else
       'Otherwise, print the whole email
       objMail.PrintOut
    End If
 
    objMail.Close olDiscard
    objMail.UnRead = True
 
    objTempWordDocument.Close False
    objWordApp.Quit
End Sub

VBA Code - Auto Print the First Page of Important Incoming Emails

  1. After that, you could exit the current window.
  2. Then go to “File” menu and click on the “Manage Rules & Alerts” button.
  3. In the popup “Rules and Alerts” dialog box, click on the “New Rule” button.
  4. Next, in the new dialog box of “Rules Wizard”, select “Apply rule on messages I receive” and hit “Next”.
  5. In the second screen of “Rules Wizard”, you ought to specify the conditions, namely defining what emails are important for you, like coming from specific senders, etc.
  6. After that, click “Next”, which will bring you to the next screen, in which you’ll need to set rule action. Select “Run a script” and opt for the previously added macro.Select “Run a script” Rule Action
  7. Later, click several “Next” until getting the last screen – “Finish rule setup”, in which you could specify a name for this rule and check the rule setting once again.
  8. Lastly click “Finish” to save this new rule.
  9. Finally, since then, every time a new important incoming email gets into your mailbox, Outlook will auto print its first page if it is too long.

Extract Maximum Data from Corrupted PST Files

Perhaps you have realized Outlook’s vulnerability. Under this circumstance, you must leave no stone unturned to safeguard your Outlook data. However, more often than not, you will find that Outlook data can get corrupt simply owing to a sudden shut down. Thus, you have to make preparations for unexpected Outlook corruption, including regular PST backups and a potent fix tool, like DataNumen Outlook Repair.

Author Introduction:

Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including recover sql and outlook repair software products. For more information visit www.datanumen.com

3 responses to “How to Auto Print the First Page of Important Incoming Emails in Your Outlook”

  1. The corrected code which is working for Outlook O365 Micrsoft cloud app is as follows :

    Sub PrintFirstPage()

    Dim objMail As Outlook.MailItem
    Set objMail = Application.ActiveExplorer.Selection.Item(1)
    objMail.Display
    SendKeys “%f”, True
    SendKeys “%p”, True
    SendKeys “%r”, True
    SendKeys “%s”, True
    SendKeys “1”, True
    SendKeys “{ENTER}”, True

    End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *