The condition on the rule should be "through specified account." You can call the SetSaveFolder code below from a "run a script" action on an Outlook rule. If you want the user to pick a folder only when the item is sent through a specific account, you will need to structure the code as a procedure that Rules Wizard can run, rather than as an Application-level event handler. MsgBox "This function isn't designed to work " & _ OlJournal, olMail, olNote, olPost, olTask Set objInbox = objNS.GetDefaultFolder(olFolderInbox)Ĭase olAppointment, olContact, olDistributionList, _ Set objApp = CreateObject("Outlook.Application") Public Function IsInDefaultStore(objOL As Object) As Boolean Private Sub Application_ItemSend(ByVal Item As Object, _ To use this code, paste it into the built-in ThisOutlookSession module in VBA in Outlook. See To quarantine application file attachments for an example of using ItemAdd. If you need to move items to a different folder, the solution would be to use the ItemAdd event on the Sent Items folder's Items collection. The IsInDefaultStore() function tests for this. The folder must be in your default information store - Exchange mailbox or PST file. Note that you must handle the situation where the user cancels the dialog, in which case PickFolder returns Nothing. This code demonstrates the use of the Namespace.PickFolder method to pop up the folder list for the user's selection. This VBA code reproduces something closer to the Notes behavior by popping up the Select Folder dialog when the user sends the message. These two macros use the ItemSend method in the macro above, but call the folder picker so you can choose a folder each time. Set Item.SaveSentMessageFolder = objFolder Set objFolder = objNS.GetDefaultFolder(olFolderSentMail).Folders("Diane") Set objNS = Application.GetNamespace("MAPI") Private Sub Application_ItemSend(ByVal Item As Object) This sample saves the sent message to a subfolder named "Diane" under the Sent Items folder. You could use an If statement to only move certain messages to the folder.
If you always want to use a different folder, you can use a macro to set the Save message to folder. In Outlook 2007 and newer, you can select a different Sent Items folder using the Save Sent Item to Command on the Options ribbon. You can select a different sent items folder for each message by selecting the folder from the Options dialog before sending the message. Select the folder when sending the message Save Replies with the Original | Using Rules to file Sent items Select the folder when sending the message | Use VBA to display a dialog