Some users long for a method to make their Outlook to automatically print out an email when it’s moved to a specific folder. As there is no such a feature supporting it, this article will guide you how to achieve it with Outlook VBA.
If you are accustomed to moving the vitally important emails to a specific folder and always need to print out these emails, you may hope that Outlook can auto print out the emails when they are moved to the specified folder. Although you’re unable to realize it via Outlook rules, it still can be achieved via VBA. Now read on to get the detailed VBA code and steps.
Auto Print an Email When It is Moved to a Specific Folder
- In the first place, you should launch your Outlook application as normal.
- Then, after entering the main Outlook screen, you need to press “Alt + F11” keys.
- Next in the subsequent “Microsoft Visual Basic for Applications” window, you need to locate and open the “ThisOutlookSession” project.
- After that, you could copy the following VBA code into this project window.
Public WithEvents objSpecificFolder As Outlook.Folder Public WithEvents objItems As Outlook.Items Private Sub Application_Startup() 'Specify the folder 'You can change it as per your needs Set objSpecificFolder = Application.Session.GetDefaultFolder(olFolderInbox).folders("Print") Set objItems = objSpecificFolder.Items End Sub 'Macro works when new item lands into the specific folder Private Sub objItems_ItemAdd(ByVal Item As Object) Dim objMail As Outlook.MailItem If TypeOf Item Is MailItem Then Set objMail = Item 'Print this mail objMail.PrintOut End If End Sub
- Subsequently, you should sign this code.
- Hit the “Tools” in the toolbar.
- From its drop down list, select “Digital Signature” option.
- Then, in the popup dialog box, follow the onscreen instructions to sign this VBA project.
- Later you can exit the VBA editor Window. In the main Outlook window, shift to “Developer” tab and click on the “Macro Security” button.
- In the popup window, you can change your Outlook macro settings to permit the digitally signed macros.
- Lastly, restart your Outlook application to activate the new macro.
- From now on, every time when an email is moved into the predefined folder, Outlook will print it out immediately.
Retrieve PST Data from Compromised File
As soon as your Outlook is subject to serious corruption, you need proceed to get back Outlook data from damaged PST file. If you have backups, it is pretty easy and convenient to restore data. If no backups, you can try the Scanpst. But if it fails, you should opt for a far more formidable recovery tool, such as DataNumen Outlook Repair. It can scan and minimize PST corruption without any fuss.
Shirley Zhang is a data recovery expert in DataNumen, Inc., which is the world leader in data recovery technologies, including corrupt mdf and outlook repair software products. For more information visit www.datanumen.com