Consulting

Results 1 to 12 of 12

Thread: Automatically add flag and reminder for ME on sent message in Outlook

  1. #1

    Automatically add flag and reminder for ME on sent message in Outlook

    Hello,

    I'm trying to automatically add flag and reminder for myself on sent messages in Outlook.

    I've found and tried numerous codes and even non-VBA solutions to flag outgoing messages for follow-up and add a reminder. But the problem is that the flag gets appended to the outgoing message and thus arrives at the recipient's side.
    Rather I'm looking for a way to not change anything for the recipient; but just add a reminder on my own outlook sent item.

    The code might have to listen to the action of a new item arriving in the sent folder.

    Can this be done?

    Thank you for any help!

  2. #2
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    Perhaps something like:
    Option Explicit
    
    Private WithEvents inboxItems As Outlook.Items
    
    Private Sub Application_Startup()
        Dim outlookApp As Outlook.Application: Set outlookApp = Outlook.Application
        Dim objectNS As Outlook.NameSpace: Set objectNS = outlookApp.GetNamespace("MAPI")
        Dim ShrdRecip As Outlook.Recipient: Set ShrdRecip = objectNS.CreateRecipient("someone@somewhere.com")
        Set inboxItems = objectNS.GetSharedDefaultFolder(ShrdRecip, olFolderInbox).Parent.Folders("Sent Items").Items
    End Sub
    
    
    Private Sub inboxItems_ItemAdd(ByVal Item As Object)
        If InStr(UCase(Item.Body), "HI") > 0 Then
            Item.FlagRequest = "Follow up"
            Item.FlagDueBy = DateAdd("d", 2, Date)
        End If
    End Sub
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

  3. #3
    Thank you for your reply Georgiboy!

    I pasted your example code in ThisOutlookSession; and updated your "someone[AT]somewhere.com" to my email address.

    I then sent a test email to some other address making sure it contained "HI" in the body

    But nothing really happened regarding follow-up flags or reminders or tasks on the message.

    I don't know what I'm doing wrong.

    Thanks again!

  4. #4
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    After you paste in the code try closing outlook and then reopen. The flag should be attached to the item in the sent folder.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

  5. #5
    Quote Originally Posted by georgiboy View Post
    After you paste in the code try closing outlook and then reopen. The flag should be attached to the item in the sent folder.
    Hi again.

    Sorry, no effect yet.

    Have you tried it with yours? Does it work with you?

    I would be very willing to send some screenshots of how it is set up etc if requested

    thanks again

  6. #6
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    Ahh I think I should have added in the Item.Save part:

    Option Explicit
    
    Private WithEvents inboxItems As Outlook.Items
    Private Sub Application_Startup()
        Dim outlookApp As Outlook.Application: Set outlookApp = Outlook.Application
        Dim objectNS As Outlook.NameSpace: Set objectNS = outlookApp.GetNamespace("MAPI")
        Dim ShrdRecip As Outlook.Recipient: Set ShrdRecip = objectNS.CreateRecipient("g.clark@maritimetransport.com")
        Set inboxItems = objectNS.GetSharedDefaultFolder(ShrdRecip, olFolderInbox).Parent.Folders("Sent Items").Items
    End Sub
    
    
    Private Sub inboxItems_ItemAdd(ByVal Item As Object)
        Dim tmp As String
        With Item
            If InStr(UCase(.Body), "HI") > 0 Then
                .FlagRequest = "Follow up"
                .FlagDueBy = Format(DateAdd("d", 2, Date) + TimeValue("18:00:00"), "dd/mm/yyyy hh:mm")
                .Save
            End If
        End With
    End Sub
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

  7. #7
    Hello again,

    Sadly it's still not working. I did try closing outlook and restarting it, but I still don't see any reminders or tasks.
    Last edited by Aussiebear; 09-21-2022 at 03:06 AM. Reason: Removed attachments at request of MrDrease

  8. #8
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    Hmm, I am not sure, will have to have a think.

    Is the name of your 'Sent Items' folder different in Belgium?

    Could try updating that in the code if it is different.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

  9. #9
    Hi Georgiboy,

    It usually is when it's in Dutch, but I'm running an English version of Office.

    Have you tested it on your side? Does a new task just just pop-up in your tasks list?

  10. #10

  11. #11
    Okay I think we might have to drop it. I'm starting to suspect it's my employer ICT department having blocked Macros in Outlook as a group security policy or something. Never got an error message or anything though.

    I'm so sorry to have wasted your time!

  12. #12
    Moderator VBAX Master georgiboy's Avatar
    Joined
    Mar 2008
    Location
    Kent, England
    Posts
    1,158
    Location
    Quote Originally Posted by MrDrease View Post
    Hi Georgiboy,

    It usually is when it's in Dutch, but I'm running an English version of Office.

    Have you tested it on your side? Does a new task just just pop-up in your tasks list?
    I was only checking the mail in the outbox to see if it had a flag on it.
    Click here for a guide on how to add code tags
    Click here for a guide on how to mark a thread as solved

    Excel 365, Version 2401, Build 17231.20084

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •