• Outlook User
  • New Outlook app
  • Outlook.com
  • Outlook Mac
  • Outlook & iCloud
  • Developer
  • Microsoft 365 Admin
    • Common Problems
    • Microsoft 365
    • Outlook BCM
    • Utilities & Addins

Mark Sent Items as Read After Copying with a Rule

Slipstick Systems

› Outlook › Rules, Filters & Views › Mark Sent Items as Read After Copying with a Rule

Last reviewed on February 27, 2020     62 Comments

Fulvio needs to use rules to move sent messages, but the sent items are not marked read when they are copied to other folders.

I’ve set up a rule for copying any message I send out to a local outbox folder (rather than the one on remote server). Therefore, I’ve uncheck the standard option “save a copy of sent messages”, as I don’t need to duplicate them remotely. Everything works fine: I have no longer remote copies of sent emails, and I have the local ones, but these latter are now bolded as unread. So, I’d like to set my custom rule as: copy sent messages to the local outbox AND mark them as read. Yet it seems to be impossible….

It's not impossible to do, but it won't work with Rules. "After Sending" rules don't support custom actions, run a script, or marking items as read. However, you can use VBA to mark sent items read.

Because the sent item is not in the default data file, you'll need to use the code at Use a folder in another pst or Mailbox to identify the data file. Paste it and the code below into the ThisOutlookSession module in the VB Editor.

Change this line: Set Items = GetFolderPath("New PST\Sent Items").Items to reflect the data file name in the folder list and the folder name you are moving the sent item to.

 

Code Sample: Mark Moved Messages as Read

To test this code, click in the Application_Startup module and press Run to start it without restarting Outlook. Don't forget to get the GetFolderPath function from Use a folder in another pst or Mailbox.

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
   Set Items = GetFolderPath("New PST\Sent Items").Items
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
End Sub

Mark deleted items read automatically

To mark messages read as they are moved into a folder within the mailbox, such as the deleted items folder, use the following code sample.

To use the junk mail folder, use
Set Items = Ns.GetDefaultFolder(olFolderJunk).Items

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
  Dim Ns As Outlook.NameSpace
  Set Ns = Application.GetNamespace("MAPI")
  Set Items = Ns.GetDefaultFolder(olFolderDeletedItems).Items
   
End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
End Sub

 

Move sent messages using VBA

This code sample moves the sent messages using VBA, rather than a rule.

If the folder you are moving the sent items to is in a different pst file, you'll need the GetFolderPath function at Use a folder in another pst or Mailbox.

Private WithEvents Items As Outlook.Items

Private Sub Application_Startup()
Set Items = Session.GetDefaultFolder(olFolderSentMail).Items

End Sub

Private Sub Items_ItemAdd(ByVal Item As Object)
    Set MovePst = GetFolderPath("NewPST\Sent Items")
    Item.UnRead = False
    Item.Move MovePst
End Sub

How to use the Macro

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. If Outlook tells you it needs to be restarted, close and reopen Outlook. Note: after you test the macro and see that it works, you can either leave macro security set to low or sign the macro.

Now open the VBA Editor by pressing Alt+F11 on your keyboard.

To use the macro code in ThisOutlookSession:

  1. Expand Project1 and double click on ThisOutlookSession.
  2. Copy then paste the macro into ThisOutlookSession. (Click within the code, Select All using Ctrl+A, Ctrl+C to copy, Ctrl+V to paste.)

Application_Startup macros run when Outlook starts. If you are using an Application_Startup macro you can test the macro without restarting Outlook by clicking in the first line of the Application_Startup macro then clicking the Run button on the toolbar or pressing F8.

More information as well as screenshots are at How to use the VBA Editor.

More Information

More VBA samples that mark moved message as read are at:
Marking Sent Items as Read How to mark messages read when they are moved to multiple folders (WindowsITPro)
E-Mail: Mark as read Mark as read when moved to a subfolder of the Inbox (vboffice.net)

Mark Sent Items as Read After Copying with a Rule was last modified: February 27th, 2020 by Diane Poremsky
Post Views: 39

Related Posts:

  • Use a VBA macro to monitor a folder in a secondary mailbox for new mes
    Monitor secondary mailbox folder for new messages
  • Use a macro to move Sent Items
  • How to use an ItemAdd Macro
  • How to automatically print sent messages

About Diane Poremsky

A Microsoft Outlook Most Valuable Professional (MVP) since 1999, Diane is the author of several books, including Outlook 2013 Absolute Beginners Book. She also created video training CDs and online training classes for Microsoft Outlook. You can find her helping people online in Outlook Forums as well as in the Microsoft Answers and TechNet forums.

Comments

  1. Jake says

    September 5, 2019 at 10:03 am

    I'm trying to combine two of the above subs and mark both the sent items and deleted items as read. But can only get one to work at a time. Here is what I have:
    Private WithEvents Items As Outlook.Items

    Private Sub Application_Startup()
    Set Items = GetFolderPath("JL RRT\Sent Items").Items
    Dim Ns As Outlook.NameSpace
    Set Ns = Application.GetNamespace("MAPI")
    Set Items = Ns.GetDefaultFolder(olFolderDeletedItems).Items

    End Sub

    Private Sub Items_ItemAdd(ByVal Item As Object)
    MarkRead Item
    End Sub

    Private Sub MarkRead(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub

    Reply
  2. A R says

    August 29, 2019 at 11:12 am

    I'm hoping to use this in combination with a rule to move a copy of each sent email to my inbox (as noted here: https://www.makeuseof.com/tag/auto-cc-bcc-outlook-gmail/ ) and automatically marking them as read, but am not quite sure how to update the example rule above to account for that. Can you point me in the right direction?

    Reply
    • Diane Poremsky says

      November 22, 2019 at 10:32 pm

      I think you'll need to use an item add macro to mark messages to you, sent from you, as read.

      Reply
  3. Elton John says

    August 14, 2018 at 10:43 am

    Don't be stupid, Outlook has an option on the sent items, above the search section there are options, All, Unread and others. just click on the unread option then select the item that you don't want to appear as unread, and that's it.

    Reply
    • Diane Poremsky says

      August 15, 2018 at 12:43 am

      it's easier just to select all and mark all as read - but why do it manually when you can automate it?

      Reply
  4. Burak says

    May 15, 2017 at 10:20 am

    This was really helpfull Diane. Thank you. i got it working with a combination of "Move sent messages using VBA" and "Mark Moved Messages as Read" with 10+ folders. Works like a charm

    Reply
  5. Tony Edwards says

    March 16, 2017 at 8:59 am

    I am struggling to get this to work within Outlook 2010 - i have an IMAP account and the Outlook Data File set as default - yet anything that is copied into the sent items of the Data File is still unread. What could I be doing wrong?

    Reply
    • Diane Poremsky says

      March 16, 2017 at 9:07 am

      Are you using the macro to mark the messages as read? What are you using for Set Items = GetFolderPath("New PST\Sent Items").Items ? It should be the display name of the data file, as seen in the folder list and the name of the sent folder - should be Sent Items if a pst file, could be something else in an IMAP account. You also need macro security on low for the macro to run.

      Reply
      • Tony Edwards says

        March 16, 2017 at 10:09 am

        This is what I have so far - I cannot seem to get the Function right

        Private WithEvents Items As Outlook.Items

        Private Sub Application_Startup()
        Set Items = GetFolderPath("Outlook Data FileSent Items").Items
        End Sub

        Private Sub Items_ItemAdd(ByVal Item As Object)
        Item.UnRead = False
        Item.Save
        End Sub

      • Diane Poremsky says

        March 16, 2017 at 12:47 pm

        what happens when you try? Did you add the function at the end of the module (or in a new module named Functions? ) https://www.slipstick.com/developer/working-vba-nondefault-outlook-folders/#GetFolderPath

        Assuming the missing slash in the path is wordpress's fault -
        Set Items = GetFolderPath("Outlook Data FileSent Items").Items

  6. Amit Singh says

    November 4, 2016 at 5:06 am

    actually it happens when we make new pst in same outlook,Though the above solution provided is ok,but we can do one more thing to remove existing pst,and restart outlook.. then all emails configuration will get download in new pst ... and then you can add removed pst in outlook .. hope it will work correctly

    Reply
  7. Willie Oosthuizen says

    September 5, 2016 at 4:44 am

    Thank you for your help, unfortunately I cannot seem to get it to work. I must be doing something wrong. I created a rule to automatically move emails from my inbox to a subfolder on a second OST file. I wish for it to be marked as "READ" as soon as it is moved but no luck. Please help

    Reply
    • Diane Poremsky says

      January 19, 2017 at 3:43 pm

      sorry I missed this earlier. You need to reference the second date file:
      Private Sub Application_Startup()
      Set Items = GetFolderPath("other@ost.name\Foldername").Items
      End Sub

      Reply
  8. AbdulSalam says

    October 10, 2015 at 1:46 am

    Hi Diana,

    Thanks for script. I have tried to use the script without success. My case is the following:
    • I checked out save forwarded messages and save copies of messages in the sent items folder from outlook options
    • I created a rule which apply after I send a massages to move a copy to "sent items" folder for massages which assigned a specific category
    • The rule works fine, but when the messages moved to the “sent items” folder, it shows “unread”
    • Can you help me to write a script to make it “read” once the massages moved to the “sent items” folder

    Thanks
    AbdulSalam

    Reply
    • Diane Poremsky says

      October 10, 2015 at 1:43 pm

      The script needs to look at the folders you move the messages to - if its the default sent items folder, you'd use this as the app startup macro to watch the sent items folder:

      Private Sub Application_Startup()
      ' this is the folder the rule is moving sent messages to
      Set Items = Session.GetDefaultFolder(olFolderSentMail).Items
      End Sub

      Reply
  9. norbertlars says

    August 4, 2015 at 4:06 am

    hey,

    so annoying this latest outlook 2013 :(

    i think there is a problem there ( at Microsoft ) and they want to get rid of clients as fast as possible

    as far as i can see best options/settings were done in outlook 2007 where all 3 of my main problems were perfect: exchange / pst / theme colors. outlook 2010 started to force an online mailbox and when i think of my work address with a PST of 17GB this is impossible :( so i must use this local storage.

    now outlook 2013 is crazy with the sent items leaving them on server FFS who could have designed this thing ? i think there are software architects that use their brain for something. okay i can understand that they want to force people to move to cloud ( they do this since 2-3 years ago ) but leave at least some ways ( even with lots of configurations ) for the rest to set things up on other ways

    so i now use outlook 2013, rules to move mails from inbox to pst folders, rule to move sent items, rule to ...rule ...

    yesterday i knock on the bright white themes :( so annoying, now i just meet the delete/flag issue. i`m so close to move back to outlook 2010 only for this 3 issues ( at least there you could find options to set things they way you like )

    so disappointing :( hope 2016 is better

    Reply
  10. Gus says

    July 17, 2015 at 9:43 am

    Hi! I'm using this code for a long time, however my Office has been upgraded today to the 2013 version and it's no longer marking sent items as read. Any trick?

    Reply
    • Diane Poremsky says

      July 17, 2015 at 1:34 pm

      Was the macro security reset to signed macros only? File, Options, Trust Center, Macro Security to check.

      Reply
  11. Jason says

    July 11, 2015 at 2:40 pm

    Hi Diane

    Wondering if you would be able to help me after coming across your webpage. I've setup a rule to move all my imap outgoing sent mail to my 'Sent Items' within my personal folders, i.e. to keep a backup using the local pst. However, the rules do not allow you to mark the sent item as read once transferred across, hence why I found you page. I applied the following code within the 'ThisOutlookSession' in the VBA Editior. I've changed the GetFolderPath address as it appears in outlook. However, to no avail as I keep getting 'Compile error: Sub or Function not defined'. I suspect this is because the path is incorrect - lost as I'm defining as it appears in outlook. Any pointers would be gratefully appreciated!

    Private WithEvents Items As Outlook.Items

    Private Sub Application_Startup()
    Set Items = GetFolderPath("Personal Folders\Sent Items").Items
    End Sub

    Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub

    Reply
    • Diane Poremsky says

      July 12, 2015 at 11:23 pm

      Did you get the getfolderpath function from https://www.slipstick.com/developer/working-vba-nondefault-outlook-folders/#GetFolderPath ?

      Reply
  12. Stephane says

    May 11, 2015 at 10:54 am

    Hi Diane,

    Thanks a lot for your time, it's almost perfect :-p !

    In my case, I have two Inbox (two IMAP accounts). So it's working fine for the first Inbox, but how to do I tell the macro to also mark as read the mails in the 2nd sent folder ?

    I have added a 2nd "items" (called Items2) in Application_Startup with the 2nd patch, but how should I invoke it in the Items_ItemAdd function ?

    Thank you for your help !

    Reply
    • Diane Poremsky says

      May 11, 2015 at 12:41 pm

      To add another folder you need to repeat these lines, using a different name (Items2 is fine)

      Private WithEvents Items2 As Outlook.Items

      Private Sub Items2_ItemAdd(ByVal Item As Object)
      Item.UnRead = False
      Item.Save
      End Sub

      Plus, add the folder to the application start up macro:
      Set Items = GetFolderPath("other datafile\Sent Items").Items

      Another way is to use the following format for each itemsadd macro, calling a shared macro. For this macro, it doesn't make much difference, but if the code was longer it could make it easier to read and update as well as keep the file smaller.
      Private Sub Items_ItemAdd(ByVal Item As Object)
      MarkRead Item
      End Sub

      Private Sub MarkRead(ByVal Item As Object)
      Item.UnRead = False
      Item.Save
      End Sub

      Reply
  13. Fred Sawtelle says

    April 29, 2015 at 2:31 pm

    I appreciate the sharing of your time and expertise. Thank you!

    Reply
  14. Fred Sawtelle says

    April 29, 2015 at 10:40 am

    I'd never given it any thought until you asked. Inbox is where I expect to find anything that needs my attention. I could set "Unread" as the default selected folder, I guess. But with Inbox I'm able to see the flow of a group conversation at a glance. With, say, five people discussing a topic it's important to me to see their comments in order, especially if I come in in the middle of it. Trying to follow it through separate folders would be frustrating, especially when there are some dead-end branches on the conversation (i.e. not everyone replies to the latest). Outlook probably provides a way of moving through a thread, but if so I've never used it; I rely on the newest-first display of Inbox to show me at a glance what's going on. What do you suggest?

    Reply
    • Diane Poremsky says

      April 29, 2015 at 11:10 am

      There are two ways to handle it:
      1. Don't file mail into a bunch of folders. Leave everything in the inbox and use Quick Steps to move mail after you've read it - i use just a couple of folders and dump almost everything into one folder called Completed. If i need to find mail to/from a specific person, i use instant search or a search folder.

      2. Use rules to file mail and use the unread search folder to read it. As long as you use the By Date (Conversations) view, it will show all messages in the conversation. (Default view is by folder).

      Reply
  15. Fred Sawtelle says

    April 28, 2015 at 11:05 pm

    I'm using 2013. Choosing the "Mark as read" option marks both of them as read. I need the one in Inbox to stay unread.

    Reply
    • Diane Poremsky says

      April 29, 2015 at 12:14 am

      Oh. That limits your options. Is there a reason why you need copies of the messages left in the inbox?

      Reply
  16. Fred Sawtelle says

    April 28, 2015 at 1:37 pm

    I have a subfolder of Inbox named "Coworkers" which in turn contains several folders named for coworkers. Rules send a copy of email from each to their respective folders. I want to mark all those emails as read while leaving the ones in Inbox unread. You've explained clearly what to do here for an individual folder. Is there a way to do it for multiple folders, short of creating an instance of Outlook.Items and an ItemAdd eventhandler for each one? For example, can I say in effect, "Mark as read everything that goes into any of the subfolders of this folder"?

    Reply
    • Diane Poremsky says

      April 28, 2015 at 7:24 pm

      Rules has an option to mark as read... which version of Outlook are you using?

      Reply
  17. Stephanie Hudson says

    January 16, 2015 at 4:47 pm

    With the code, all new mail in my folder is being marked as read, not just the newly sent mail. How can I alter the code so that only the mail sent from myself is marked as read.

    Details:
    I'm wanting to keep conversation threads together, including sent mail. Ideally I want all this mail in my inbox until I decide I'm done with it and save it to another folder elsewhere. That is, I want all incoming mail and sent mail in the same "inbox" folder. Right now, I'm doing that in a folder directly below Outlook's inbox called "_My Inbox_".

    A. I have a rule: After I send a message, move a copy to the "_My Inbox_" folder.
    B. I have a bunch of other rules handling mail that can go to other folders or the trash.
    C. My last rule is: After a message arrives, move it to the "_My Inbox_" folder.
    D. In Mail Options, Save messages settings, I have "When replying to a message that is not in the Inbox, save the reply in the same folder" ticked (true).
    E. In Mail Options, Save messages settings, I have "Save copies of messages in the Sent Items folder" NOT ticked (false).
    -------
    What's happening is that the Sent mail is Unread.
    I tried adding a rule to mark mail from me (sent) as read, but this doesn't work as the mail just gets moved there, it doesn't actually "arrive" as the rule expects.
    -------
    F. So, I found your code and have applied it. However, now ALL mail coming to "_My Inbox_" is marked as read.

    How can I alter the code so that only the mail sent from myself is marked as read.

    Reply
    • Diane Poremsky says

      January 16, 2015 at 10:25 pm

      Remove the rules that touch sent items and mark them read. Use the Move sent messages using VBA macro to move the message and mark it as read.

      Use this as the move to location:
      Set MovePst = Session.GetDefaultFolder(olFolderInbox)

      Reply
      • Stephanie Hudson says

        January 19, 2015 at 9:13 am

        Am I putting that in the Application_Startup()? I currently have:
        Private Sub Application_Startup()
        Set Items = Session.GetDefaultFolder(olFolderInbox).Folders("_My Inbox_").Items
        End Sub

        Sorry, this is my first time with VBA in Outlook. Only used it in Excel and Access before.
        Thanks.

      • Diane Poremsky says

        January 20, 2015 at 11:53 pm

        The folder in the application start up is the one Outlook is watching. The folder you are moving sent items to is identified as the MovePst folder: (movepst may not make sense if you aren't moving it to a pst, but it's only a variable name and will work)
        Set MovePst = GetFolderPath("NewPST\Sent Items")

        If the folder you are moving mail to is a subfolder of the inbox and is named _My_Inbox_ then you want the movepst line to be
        Set MovePst = Session.GetDefaultFolder(olFolderInbox).Folders("_My Inbox_").Items

      • Stephanie Hudson says

        January 21, 2015 at 9:22 am

        It's working now. Thank you so much for your help! I really appreciate it.

  18. Chris says

    August 26, 2014 at 11:34 am

    My code is this but it gives me " object variable or with block variable not set 91" - What is wrong?

    Private WithEvents Items As Outlook.Items
    Private Sub Application_Startup()
    Dim Items As Outlook.Items
    Set Items = GetFolderPath("C:\Users\cc580e\Desktop\Chirag - Personal Folders(1).pst\Sent Items").Items
    MsgBox "test"
    End Sub
    Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub
    Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
    Dim oFolder As Outlook.Folder
    Dim FoldersArray As Variant
    Dim i As Integer

    On Error GoTo GetFolderPath_Error
    If Left(FolderPath, 2) = "\\" Then
    FolderPath = Right(FolderPath, Len(FolderPath) - 2)
    End If
    'Convert folderpath to array
    FoldersArray = Split(FolderPath, "\")
    Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
    If Not oFolder Is Nothing Then
    For i = 1 To UBound(FoldersArray, 1)
    Dim SubFolders As Outlook.Folders
    Set SubFolders = oFolder.Folders
    Set oFolder = SubFolders.Item(FoldersArray(i))
    If oFolder Is Nothing Then
    Set GetFolderPath = Nothing
    End If
    Next
    End If
    'Return the oFolder
    Set GetFolderPath = oFolder
    Exit Function
    GetFolderPath_Error:
    Set GetFolderPath = Nothing
    Exit Function
    End Function

    Reply
    • Diane Poremsky says

      August 29, 2014 at 11:29 pm

      getfolderpath path is wrong, should be the display name and folders as it appears in the folder list.

      Reply
  19. Marek says

    February 18, 2014 at 4:01 am

    I don't think so Diane. I've already tested it with "Sent Items" and I am getting error: Run-time error 91. https://1drv.ms/1cPCjOE

    Reply
    • Diane Poremsky says

      February 18, 2014 at 11:04 am

      If you are getting the when Outlook restarts or when you click in Application_Startup and click Run, it means the macro can't find the folder. Replace it with archive or one of the other names with only ASCII characters and click Run in the App Startup macro.

      Reply
  20. Marek says

    February 17, 2014 at 6:13 am

    Once again thank you Diane for your patience, but maybe I am stupid enough because after I am hitting RunSub/UserForm(F5) button, nothing is happend. I made two screenshots of my project/outlook. If you have a time, please look at this. https://1drv.ms/1cPCjOE Maybe you will find something what I am still missing...
    Just for testing purpose i have used this guide https://msdn.microsoft.com/en-us/library/office/ff869298.aspx and message box appears correctly.

    Reply
    • Diane Poremsky says

      February 17, 2014 at 11:46 am

      I'm guessing its the localization that is the problem. You tried it both with the localized name and "Sent Items"?

      Reply
  21. Marek says

    February 14, 2014 at 4:15 am

    Thank you for an answer but I did exactly what you wrote without success. Messages in Sent folder still remain marked as unread. Please can you check my full code:

    Private WithEvents Items As Outlook.Items
    Private Sub Application_Startup()
    Set Items = GetFolderPath("Personal Folders\Sent Items").Items
    End Sub
    Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub
    Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
    Dim oFolder As Outlook.Folder
    Dim FoldersArray As Variant
    Dim i As Integer

    On Error GoTo GetFolderPath_Error
    If Left(FolderPath, 2) = "\\" Then
    FolderPath = Right(FolderPath, Len(FolderPath) - 2)
    End If
    'Convert folderpath to array
    FoldersArray = Split(FolderPath, "\")
    Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
    If Not oFolder Is Nothing Then
    For i = 1 To UBound(FoldersArray, 1)
    Dim SubFolders As Outlook.Folders
    Set SubFolders = oFolder.Folders
    Set oFolder = SubFolders.Item(FoldersArray(i))
    If oFolder Is Nothing Then
    Set GetFolderPath = Nothing
    End If
    Next
    End If
    'Return the oFolder
    Set GetFolderPath = oFolder
    Exit Function
    GetFolderPath_Error:
    Set GetFolderPath = Nothing
    Exit Function
    End Function

    Reply
    • Diane Poremsky says

      February 14, 2014 at 10:48 pm

      It works here. Did you click in Application startup macro and click run to kick start it?

      Try adding msgbox "Working" as the first line of the itemadd macro - when the macro fires the message box will come up. That will tell us if its working.

      Private Sub Items_ItemAdd(ByVal Item As Object)
      msgbox "Working"
      Item.UnRead = False
      Item.Save
      End Sub

      Reply
    • Charitha says

      October 3, 2015 at 7:35 am

      I think you should give the folder name instead of giving Sent Items
      Set Items = GetFolderPath("Personal Folders\Sent Items").Items
      eg. Set Items = GetFolderPath("Personal Folders\Test").Items

      Reply
      • Diane Poremsky says

        October 3, 2015 at 4:28 pm

        In this example, the person who requested the macro wanted to move the mail from the sent items folder in one data file to the sent items folder in another data file, that is why i used the sent folder name.

        If you are keeping it in the same data file, but moving to a different folder you would use getdefaultfolder instead:
        Dim NS As Outlook.NameSpace
        Set NS = Application.GetNamespace("MAPI")
        'folder is subfolder of sent items
        Set Items = NS.GetDefaultFolder(olFolderSentMail).Folders("Test")
        or
        ' same level as sent
        Set Items = NS.GetDefaultFolder(olFolderSentMail).parent.Folders("Test")

  22. Marek says

    February 12, 2014 at 8:54 am

    No, as I wrote before, I had only insert new "Module/Class Module" Right now I try paste code as you mention but nothing is happening. "Unread" message still remain in Sent folder... No matter if I hit F5 key or Outlook was closed/reopened.

    Reply
    • Diane Poremsky says

      February 12, 2014 at 11:00 pm

      After you paste it in ThisOutlookSession, you need to click in the Application Startup macro and press the run button - this will start the macro without actually restarting outlook.

      Reply
  23. Marek says

    February 7, 2014 at 8:50 am

    Hello Diane, I dont know where I am doing mistake but I cannot make this to work. I just copy/paste Martins code from September 25. where I only changed GetFolderPath to right PST folder but i am getting this error: "Compile error: Only valid object module" (Private WithEvents Items... line is in red color). In ThisOutlookSession have I insert Module or Class Module? When I try to insert Class module I am not able to test/save project...
    Please can you provide whole working code - with GetFolderPath? Thank you in advance. Marek

    Reply
    • Diane Poremsky says

      February 7, 2014 at 8:26 pm

      Did you try pasting it in ThisOutlookSession? Double click on ThisOutlooksession on the left to open it on the right side of the editor.

      Reply
  24. Chris Gilbert says

    June 20, 2013 at 12:12 am

    Don't know if anyone is reading this old thread, but I think if I turn off the save copy in Sent folder in Email Options and handle everything through Rules, then my Journal can't be used to save incoming and outgoing emails as entries there for record-keeping purposes which I find valuable for recreating my work for billing purposes.

    Reply
    • Diane Poremsky says

      June 20, 2013 at 7:31 am

      It's possible - i have not tested it with journaling, in part because the journal is broken in Outlook 2010 and sent to death row in 2013.

      Reply
  25. Martins says

    September 25, 2012 at 9:58 am

    P.S. I try to run it for sent mails that are moved to Inbox subfolders..

    Thanks again!

    Reply
    • Diane Poremsky says

      September 25, 2012 at 12:07 pm

      This part needs to be at the top of ThisOutlookSession.

      Private WithEvents Items As Outlook.Items
      Private Sub Application_Startup()
      Set Items = GetFolderPath("New PST\Sent Items").Items
      End Sub

      Also, you only need the GetFolderPath function from the bottom of the other page, not all of the code on the page. (I'll fix my instructions.)

      Reply
  26. Martins says

    September 25, 2012 at 9:56 am

    Hi Diane,

    I try to get this work, but it comes back with: Compile error: "Invalid attribute in Sub or Function" and marks "WithEvents Items As Outlook.Items"

    Thanks for help!

    My full code:

    Private WithEvents Items As Outlook.Items
    Private Sub Application_Startup()
    Set Items = GetFolderPath("New PST\Sent Items").Items
    End Sub
    Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub
    Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
    Dim oFolder As Outlook.Folder
    Dim FoldersArray As Variant
    Dim i As Integer

    On Error GoTo GetFolderPath_Error
    If Left(FolderPath, 2) = "\\" Then
    FolderPath = Right(FolderPath, Len(FolderPath) - 2)
    End If
    'Convert folderpath to array
    FoldersArray = Split(FolderPath, "\")
    Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
    If Not oFolder Is Nothing Then
    For i = 1 To UBound(FoldersArray, 1)
    Dim SubFolders As Outlook.Folders
    Set SubFolders = oFolder.Folders
    Set oFolder = SubFolders.Item(FoldersArray(i))
    If oFolder Is Nothing Then
    Set GetFolderPath = Nothing
    End If
    Next
    End If
    'Return the oFolder
    Set GetFolderPath = oFolder
    Exit Function
    GetFolderPath_Error:
    Set GetFolderPath = Nothing
    Exit Function
    End Function

    Reply
    • Diane Poremsky says

      September 25, 2012 at 12:19 pm

      Make sure you change the path here to the actual pst name folder -

      Set Items = GetFolderPath("New PST\Sent Items").Items

      and it should work (when you put the first part at the top of =ThisOutlookSession as per my other comment). You need just the code in the comment (I removed the stuff you don't need, to reduce confusion and make it easier to read.)

      Reply
    • Diane Poremsky says

      September 25, 2012 at 12:20 pm

      Make sure you change the path here to the actual pst name folder -

      Set Items = GetFolderPath("New PST\Sent Items").Items

      and it should work (when you put the first part at the top of (ThisOutlookSession as per my other comment). You need just the code in the comment (I removed the stuff you don't need, to reduce confusion and make it easier to read.)

      Reply
  27. Stuart says

    May 25, 2012 at 9:12 am

    Hi Diane

    I got the code in to mark all the emails as read when sent from one email address and stored in a defined folder.
    Now how do I start a new project to do the same thing for the other email address and its defined folder.

    I don't know how to start a new project.

    using outlook 2007

    thanks

    Reply
  28. Fulvio says

    May 18, 2012 at 12:24 pm

    Great! It works perfectly!
    Thanks a million.

    Reply
  29. Fulvio says

    May 18, 2012 at 8:23 am

    Dear Diane,
    said that I'm quite far from being a VBA expert (in fact, this is my very first time), I tried to write down in sequence, under ThisOutlookSession module, what you indicated, following the instructions for replacing the string as well. As soon as I try to run the module to test it, I got an error message (translating from italian): "Invalid attribute within Sub or Function". could you help me further? Thanks
    Hereafter what is currently in my editor:

    Function GetFolderPath(ByVal FolderPath As String) As Outlook.Folder
    Dim oFolder As Outlook.Folder
    Dim FoldersArray As Variant
    Dim i As Integer

    On Error GoTo GetFolderPath_Error
    If Left(FolderPath, 2) = "\\" Then
    FolderPath = Right(FolderPath, Len(FolderPath) - 2)
    End If
    'Convert folderpath to array
    FoldersArray = Split(FolderPath, "\")
    Set oFolder = Application.Session.Folders.Item(FoldersArray(0))
    If Not oFolder Is Nothing Then
    For i = 1 To UBound(FoldersArray, 1)
    Dim SubFolders As Outlook.Folders
    Set SubFolders = oFolder.Folders
    Set oFolder = SubFolders.Item(FoldersArray(i))
    If oFolder Is Nothing Then
    Set GetFolderPath = Nothing
    End If
    Next
    End If
    'Return the oFolder
    Set GetFolderPath = oFolder
    Exit Function

    GetFolderPath_Error:
    Set GetFolderPath = Nothing
    Exit Function
    End Function

    Private WithEvents Items As Outlook.Items

    Private Sub Application_Startup()
    Set Items = GetFolderPath("Cartelle Personali\Posta Inviata").Items
    End Sub

    Private Sub Items_ItemAdd(ByVal Item As Object)
    Item.UnRead = False
    Item.Save
    End Sub

    Reply
    • Diane Poremsky says

      May 18, 2012 at 11:55 am

      Do the colors of the text in the VBA editor more or less match the ones on the pages online? Red text is bad. Check the quotes and verify they are plain old quotes and not smart quotes.

      Reply
    • Diane Poremsky says

      May 18, 2012 at 12:13 pm

      Oh, and also put the Function code after the other code.

      Reply
  30. Claire says

    May 17, 2012 at 8:11 am

    Good to know--though I must say that Gmail's "mark as read" option for foldered mail is a bit quicker than VBA ;)

    Reply
    • Diane Poremsky says

      May 17, 2012 at 8:44 am

      If you use rules to move mail, you can mark read using rules - but Outlook only lets you copy mail after sending and doesn't offer a mark as read option for it. (Don't ask me why - I think it should.)

      Reply

Leave a Reply Cancel reply

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

Visit Slipstick Forums.
What's New at Slipstick.com

Latest EMO: Vol. 31 Issue 3

Subscribe to Exchange Messaging Outlook






Support Services

Do you need help setting up Outlook, moving your email to a new computer, migrating or configuring Office 365, or just need some one-on-one assistance?

Our Sponsors

CompanionLink
ReliefJet
  • Popular
  • Latest
  • Week Month All
  • Jetpack plugin with Stats module needs to be enabled.
  • Error Opening iCloud Appointments in Classic Outlook
  • Opt out of Microsoft 365 Companion Apps
  • Mail Templates in Outlook for Windows (and Web)
  • Urban legend: Microsoft Deletes Old Outlook.com Messages
  • Buttons in the New Message Notifications
  • Move Deleted Items to Another Folder Automatically
  • Open Outlook Templates using PowerShell
  • Count and List Folders in Classic Outlook
  • Google Workspace and Outlook with POP Mail
  • Import EML Files into New Outlook
Ajax spinner

Recent Bugs List

Microsoft keeps a running list of issues affecting recently released updates at Fixes or workarounds for recent issues in classic Outlook (Windows).

For new Outlook for Windows: Fixes or workarounds for recent issues in new Outlook for Windows .

Outlook for Mac Recent issues: Fixes or workarounds for recent issues in Outlook for Mac

Outlook.com Recent issues: Fixes or workarounds for recent issues on Outlook.com

Office Update History

Update history for supported Office versions is at Update history for Office

Outlook Suggestions and Feedback

Outlook Feedback covers Outlook as an email client, including Outlook Android, iOS, Mac, and Windows clients, as well as the browser extension (PWA) and Outlook on the web.

Outlook (new) Feedback. Use this for feedback and suggestions for Outlook (new).

Use Outlook.com Feedback for suggestions or feedback about Outlook.com accounts.

Other Microsoft 365 applications and services




New Outlook Articles

Error Opening iCloud Appointments in Classic Outlook

Opt out of Microsoft 365 Companion Apps

Mail Templates in Outlook for Windows (and Web)

Urban legend: Microsoft Deletes Old Outlook.com Messages

Buttons in the New Message Notifications

Move Deleted Items to Another Folder Automatically

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Google Workspace and Outlook with POP Mail

Import EML Files into New Outlook

Newest Code Samples

Open Outlook Templates using PowerShell

Count and List Folders in Classic Outlook

Insert Word Document into Email using VBA

Warn Before Deleting a Contact

Use PowerShell to Delete Attachments

Remove RE:, FWD:, and Other Prefixes from Subject Line

Change the Mailing Address Using PowerShell

Categorize @Mentioned Messages

Send an Email When You Open Outlook

Delete Old Calendar Events using VBA

VBA Basics

How to use the VBA Editor

Work with open item or selected item

Working with All Items in a Folder or Selected Items

VBA and non-default Outlook Folders

Backup and save your Outlook VBA macros

Get text using Left, Right, Mid, Len, InStr

Using Arrays in Outlook macros

Use RegEx to extract message text

Paste clipboard contents

Windows Folder Picker

Custom Forms

Designing Microsoft Outlook Forms

Set a custom form as default

Developer Resources

Developer Resources

Developer Tools

VBOffice.net samples

SlovakTech.com

Outlook MVP David Lee

Repair PST

Convert an OST to PST

Repair damaged PST file

Repair large PST File

Remove password from PST

Merge Two Data Files

Sync & Share Outlook Data

  • Share Calendar & Contacts
  • Synchronize two computers
  • Sync Calendar and Contacts Using Outlook.com
  • Sync Outlook & Android Devices
  • Sync Google Calendar with Outlook
  • Access Folders in Other Users Mailboxes

Diane Poremsky [Outlook MVP]

Make a donation

Mail Tools

Sending and Retrieval Tools

Mass Mail Tools

Compose Tools

Duplicate Remover Tools

Mail Tools for Outlook

Online Services

Calendar Tools

Schedule Management

Calendar Printing Tools

Calendar Reminder Tools

Calendar Dates & Data

Time and Billing Tools

Meeting Productivity Tools

Duplicate Remover Tools

Productivity

Productivity Tools

Automatic Message Processing Tools

Special Function Automatic Processing Tools

Housekeeping and Message Management

Task Tools

Project and Business Management Tools

Choosing the Folder to Save a Sent Message In

Run Rules on messages after reading

Help & Suggestions

Submit Outlook Feature Requests

Slipstick Support Services

Buy Microsoft 365 Office Software and Services

Visit Slipstick Forums.

What's New at Slipstick.com

Home | Outlook User | Exchange Administrator | Office 365 | Outlook.com | Outlook Developer
Outlook for Mac | Common Problems | Utilities & Addins | Tutorials
Outlook & iCloud Issues | Outlook Apps
EMO Archives | About Slipstick | Slipstick Forums
Submit New or Updated Outlook and Exchange Server Utilities

Send comments using our Feedback page
Copyright © 2026 Slipstick Systems. All rights reserved.
Slipstick Systems is not affiliated with Microsoft Corporation.