If you use conditions in the rule to filter the messages, you can remove the If.Then and End If lines from the code. The macro will set the message to expire in 1 day. Configure AutoArchive to delete expired messages.Create a filter for your view that hides expired messages between AutoArchive runs.
![outlook how to empty trash outlook how to empty trash](https://www.lifewire.com/thmb/vQ7TctKbNAEjVa3sd8ZKlVjZFKg=/1920x1048/filters:no_upscale():max_bytes(150000):strip_icc()/04-how-to-create-a-new-message-using-stationery-in-outlook-7430f324d81b4cb1918ba6b42ffecf79.jpg)
If you set all of the conditions in the rule, you can delete the If.Then and End If lines.
![outlook how to empty trash outlook how to empty trash](https://i.pinimg.com/originals/32/e5/2c/32e52c38c249bf05dafeac74c99b5cac.jpg)
Once you verify the macro works, you can use SelfCert to sign the macro, at which point you will change the security setting to allow signed macros only. Macro security should be set to Low during testing. When a message is expired it's displayed in the message list in a gray strikethrough font.Ĭheck macro security settings. Note: If you use Microsoft Exchange Server 2010 with online mailbox archives, you won't be able to use autoarchive in Outlook 20.įollow these steps to create a run a script rule to add an expire date and then configure AutoArchive to delete the messages.
![outlook how to empty trash outlook how to empty trash](https://www.howtogeek.com/wp-content/uploads/2016/04/01_clicking_file_tab.png)
If you need help configuring autoarchive settings, watch the tutorial: Configuring AutoArchive settings in Microsoft Outlook.