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
- To begin with, you need to launch your Outlook application as normal.
- Then in the main Outlook window, you need to press “Alt + F11” keys.
- Subsequently, you will access VBA editor in success.
- 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
- After that, you could exit the current window.
- Then go to “File” menu and click on the “Manage Rules & Alerts” button.
- In the popup “Rules and Alerts” dialog box, click on the “New Rule” button.
- Next, in the new dialog box of “Rules Wizard”, select “Apply rule on messages I receive” and hit “Next”.
- 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.
- 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.
- 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.
- Lastly click “Finish” to save this new rule.
- 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