When I reply to a message, I want to save that particular message in the "Reply by me" folder in Outlook.
Solution: a macro that watches for reply, reply all or forward and files the original message after creating the reply/forward.
Tip: if you are filing all messages in the same folder, use a Quick Step in Outlook 2010 and above.
This macro moves the original message to a folder under the Inbox. The subfolder is created from the sender's display name. Because names can vary when a user uses multiple email clients, it may be better (but less user friendly) to use the email address.
Option Explicit Private WithEvents oExpl As Explorer Private WithEvents oItem As MailItem Private bDiscardEvents As Boolean Dim oResponse As MailItem Private Sub Application_Startup() Set oExpl = Application.ActiveExplorer bDiscardEvents = False End Sub Private Sub oExpl_SelectionChange() On Error Resume Next Set oItem = oExpl.Selection.Item(1) End Sub ' Reply Private Sub oItem_Reply(ByVal Response As Object, Cancel As Boolean) Cancel = True bDiscardEvents = True Set oResponse = oItem.Reply afterReply End Sub ' Forward Private Sub oItem_Forward(ByVal Response As Object, Cancel As Boolean) Cancel = True bDiscardEvents = True Set oResponse = oItem.Forward afterReply End Sub ' Reply all Private Sub oItem_ReplyAll(ByVal Response As Object, Cancel As Boolean) Cancel = True bDiscardEvents = True Set oResponse = oItem.ReplyAll afterReply End Sub Private Sub afterReply() Dim NS As Outlook.NameSpace Dim objDestFolder As Outlook.Folder Dim objInbox As Outlook.Folder Dim sSenderName As String oResponse.Display sSenderName = oItem.SentOnBehalfOfName If sSenderName = ";" Then sSenderName = oItem.SenderName End If Set NS = Application.GetNamespace("MAPI") Set objInbox = NS.GetDefaultFolder(olFolderInbox) On Error Resume Next Set objDestFolder = objInbox.Folders(sSenderName) If objDestFolder Is Nothing Then Set objDestFolder = objInbox.Folders.Add(sSenderName) End If oItem.Move objDestFolder bDiscardEvents = False Set oItem = Nothing Set objDestFolder = Nothing Set objInbox = Nothing Set NS = Nothing End Sub
How to use macros
First: You will need macro security set to low during testing.
To check your macro security in Outlook 2010 or 2013, go to File, Options, Trust Center and open Trust Center Settings, and change the Macro Settings. In Outlook 2007 and older, it’s at Tools, Macro Security.
After you test the macro and see that it works, you can either leave macro security set to low or sign the macro.
Open the VBA Editor by pressing Alt+F11 on your keyboard.
To put the code in a module:
- Right click on Project1 and choose Insert > Module
- Copy and paste the macro into the new module.
More information as well as screenshots are at How to use the VBA Editor