Categories
Microsoft Office Technology

Automatically file Outlook Sent Items to a folder

A commenter on one of my other macros requested this functionality.

Whenever you send an e-mail in Outlook have it prompt you if you want it filed in a folder other than the default Sent Items folder.
Here it is.

Two caveats:
I’m assuming that you are using the default Sent Items folder.
You will have to edit the code to point it to the folder you wish to use.


First you have to define the event handler to monitor your sent items folder.

Private WithEvents SentItems As Outlook.Items

Private Sub Application_Startup()

 Dim NS As Outlook.NameSpace
 Set NS = Application.GetNamespace("MAPI")
 Set SentItems = NS.GetDefaultFolder(olFolderSentMail).Items

End Sub

Now you have to add a routine to handle it.

Private Sub SentItems_ItemAdd(ByVal item As Object)
 
 Dim objMailItem As mailItem
 Set objMailItem = item
 Dim arcFolder As Outlook.MAPIFolder
 Set arcFolder = Outlook.Application.Session.Folders.item("Personal Folders (C)").Folders.item("___ToDo")
 If MsgBox("Move To ToDo?", vbYesNo) = vbYes Then
 objMailItem.Move arcFolder
 End If
 
End Sub

I have a “ToDo” folder in my Personal Folders mailbox (the leading underscores are simply to “help” the sorting in the default view.

It’s this arcFolder location that you will have to adjust to your own required location.

 

2 replies on “Automatically file Outlook Sent Items to a folder”

Hi Ross, this is very nice indeed. I really appreciate you openness to requests for macros like this. 🙂

Is there a way to edit this to save a copy to the arc folder, maybe after the saving to the sent folder (or other folder, since I use a plug in called SImplyFile to set up outgoing email filing)?

Maybe it’s just a change to the command from objMailItem.Move arcFolder to something like objMailItem.Copy arcFolder? 🙂

Are you sure that you want two physical copies of your mail?
An alternative would be to use categories = eg add a “ForFollowUp” category.
You can then sort/filter or create Search Folders to highlight these categories.

Failing that – it would be something along the lines of:
set objNewMailItem = objMailItem.copy
objNewMailItem.move arcFolder

Leave a Reply

Your email address will not be published. Required fields are marked *