Do you often want to print out the tasks assigned by others or the meetings sent by others? Why not configure Outlook to auto print out them? This article will tell you how to achieve it with Outlook VBA.
Outlook allows users to assign tasks and send meeting invitations to others. Have you ever received tasks requests or meeting requests in Outlook? Take me for an example. I often received this kind of requests from my superior. Since that these tasks and meetings are considerably important and urgent, I often print out them in paper. In the past, I normally printed them manually. However, at present, I am using a more intelligent method. That is to enable Outlook to automatically print them as soon as they arrive in my mailbox. Are you interested in this means? If so, you can read on to get the detailed codes as well as operations.
Auto Print Tasks or Meetings As They Arrive in Your Outlook Mailbox
- In the first place, you should launch Outlook and head to “Developer” tab.
- Then you could locate and click on the “Visual Basic” button.
- Next in the popup VBA editor window, double click the “ThisOutlookSession” project on the left side to open it.
- In the opened “ThisOutlookSession” project window, you ought to copy and paste the following VBA codes:
Public WithEvents olItems As Outlook.Items Private Sub Application_Startup() Set olItems = Outlook.Application.Session.GetDefaultFolder(olFolderInbox).Items End Sub Private Sub olItems_ItemAdd(ByVal Item As Object) Dim olTask As TaskItem Dim olAppt As AppointmentItem Dim olMail As MailItem If TypeName(Item) = "TaskRequestItem" Then Set olTask = Item.GetAssociatedTask(True) olTask.PrintOut End If If TypeName(Item) = "MeetingItem" Then Set olAppt = Item.GetAssociatedAppointment(True) olAppt.PrintOut End If If TypeName(Item) = "MailItem" Then Set olMail = Item If InStr(LCase(olMail.Subject), "task") > 0 Or InStr(LCase(olMail.Subject), "meeting") > 0 Then olMail.PrintOut End If End If End Sub
- After that, you need to digitally sign the current VBA project.
- Firstly, you can go to “Start Menu” and type “VBA” in the search box. You’ll find an inbuilt tool. Use it to create a certificate.
- Then back to the “ThisOutlookSession” project and assign the certificate to it.
- Subsequently, you should proceed to change your Outlook macro settings to only enable digitally signed macros.
- Finally, you can restart Outlook to activate the new VBA project. From now on, the meetings and tasks sent by other people will be printed automatically.
Watch out for Malicious Macros
Outlook is susceptible to corruption, especially when faced with malicious macro, namely virus and malware. Once your Outlook data is infected, the inbox repair tool, Scanpst.exe must be of no avail. At that point, your last resort is employing a more powerful Outlook PST data repair tool, such as DataNumen Outlook Repair.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including repair damaged SQL Server data and outlook repair software products. For more information visit www.datanumen.com