Clear Flag on all sent tiems by scipt RRS feed

  • Question

  • Hi to all!

    I wanna clear flag (and categories) on all itemes inside "Sent items" folder, automatically by script. I found this macro but not working on my Outlook 2010:

    Also, is possible run a macro automatically?

    My goal is cleanup sent items because those flagged will not archived


    Wednesday, December 23, 2015 12:33 PM


  • Hello,

    > I found this macro but not working on my Outlook 2010:

    What code exactly do you have now? Most probably you need to use the global Application property for instantiating an instance of the Application class.

    Anyway, you can handle the ItemAdd event which is fired when one or more items are added to the specified collection. So, the VBA sub will be called when a new item(s) is added to the folder.

    Public WithEvents myOlItems As Outlook.Items 
    Public Sub Initialize_handler()  
     Set myOlItems = Application.GetNamespace("MAPI").GetDefaultFolder(olFolderContacts).Items  
    End Sub 
    Private Sub myOlItems_ItemAdd(ByVal Item As Object)  
     ' process the added item there - see the Item object passed 
    End Sub

    Finally, the Getting Started with VBA in Outlook 2010 article is a good start for newbies.

    Wednesday, December 23, 2015 1:09 PM