Consulting

Results 1 to 5 of 5

Thread: "Sent button not clicked" reminder

  1. #1

    "Sent button not clicked" reminder

    for Outlook 2007:

    Request:
    Some code suggestions on how to, for each email that is being composed:
    * set up a timer from when it was first started (i.e. "Compose New Email", "Reply", or "Reply All" button clicked)
    * pop up a messagebox if it's been open for more than 30 minutes (repeat every 30 minutes)
    * cancel the timer if the email is sent ("Sent" button clicked)
    * do this for all currently-open emails concurrently

    so if message A was started at 12:05 and message B at 12:12, I should get a reminder about message A at 12:35, and a separate reminder for message B at 12:42

    some sort of code that will run within Outlook automatically would be best, in VBA or .NET

    (I'll be able to replace the messagebox with something a bit less annoying and handle saving to Drafts when I have time to play with it, but thought I'd throw the basic question out there to save myself from having to reinvent the wheel, if anyone has done this sort of thing before)


    Background:
    I am hammered by a bunch of conflicting schedules, requests, etc. Which means that while writing an email reply to someone, something else comes in which is much higher priority, which is occasionally interrupted by something else... so I have dozens of windows open, and even low-priority things start annoying people when I don't send a reply for 6 hours at a stretch.

  2. #2
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    Using VBA, Outlook can make reminders appear programmatically ... which you can simply dismiss or ignore, same as an email. Why would you pay attention to that and not the email which you already have in the taskbar?

    Let me explain. We could write a complicated macro that hooks onto the NewInspector event (when you start writing an email) and creates a task reminder 30 minutes out, all the while tracking the entry ID for the message to see when it is sent. That task reminder could either display itself or create a messagebox. However, that is just one more thing to ignore when something with higher priority comes in.

    You want to replace the messagebox with something less annoying, but Outlook has limited options on that. Besides, you want the reminder to be annoying (so you would send the email, getting rid of the reminder in the process). I imagine there may be a paid solution out there somewhere, if you want to go that route.

    Any programmatic solution would only make your interruptions worse. It's none of my business, but you should work on external solutions, such as delegating low-priority work (including delegating your Inbox), choosing specific times to answer emails and setting expectations with requestors. Apologies if that isn't the answer you are looking for.
    Regards,
    JP

    Read the FAQ
    Getting free help on the web
    My website
    Please use [vba][/vba] tags when posting code

  3. #3
    Quote Originally Posted by JP2112
    Any programmatic solution would only make your interruptions worse. It's none of my business, but you should work on external solutions, such as delegating low-priority work (including delegating your Inbox), choosing specific times to answer emails and setting expectations with requestors.
    I'm the person people delegate things to!

    The issue is not so much the interruptiness (that will happen regardless) as the fact that after I'm sufficiently interrupted I forget that I was working on something else - and I tend to have *lots* of things open at once to handle everything (38 taskbar icons open right now!), so while looking at the taskbar works - it doesn't work at a glance, I have to actually look into it.

    Mostly I was hoping someone would reply with a "oh yeah, there's a two-line call you can make to do all that!", since I don't really want to spend the time digging into NewInspector etc myself just now.

    If there isn't, I'll have to hack together something later (or hope someone posts some code )

  4. #4
    VBAX Expert JP2112's Avatar
    Joined
    Oct 2008
    Location
    Astoria, NY
    Posts
    590
    Location
    Sorry to hear that. Believe me, I understand your pain, I know people who sit all day with 20+ workbooks, 10+ emails, 3 Explorer windows and a PPT presentation open all day. Not to mention the 1k+ emails spread across 200+ folders.

    Being interrupted and having trouble getting back on track is a normal human condition (I believe the average is 10 minutes to get back to the original task? Can't find the source). That's why I suggest a programmatic solution will not solve the underlying problem.

    I believe there is a job posting section on this forum, you might try posting this there because it is a big job and it will be hard to find someone to do it for free.
    Regards,
    JP

    Read the FAQ
    Getting free help on the web
    My website
    Please use [vba][/vba] tags when posting code

  5. #5
    Started running into this problem again, so went and dug up some code

    The following is a step in the right direction, but the mail will not open until the macro actually terminates (so this will keep popping up the messagebox forever, *instead* of opening the email)

    Spent 15 minutes looking for a way to trigger custom events from outlook VBA, no luck so far...

    Suggestions on fixing would be appreciated, otherwise I'll just post an update when/if I get around to figuring this out.


    Dim WithEvents colInsp As Outlook.Inspectors
    ' Application.Wait doesn't work in outlook 2007, so pull in the windows Sleep function
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliSeconds As Long)
     
    ' MessageBox is a non-modular version of MsgBox
       Private Declare Function MessageBox _
            Lib "User32" Alias "MessageBoxA" _
               (ByVal hWnd As Long, _
                ByVal lpText As String, _
                ByVal lpCaption As String, _
                ByVal wType As Long) _
            As Long
     
    Private Sub Application_Startup()
        Set colInsp = Application.Inspectors
    End Sub
    Private Sub colInsp_NewInspector(ByVal Inspector As Inspector)
        Dim objMail As Outlook.MailItem
        Dim a As Outlook.MailItem
     
        If Inspector.CurrentItem.Class = olMail Then
            Set objMail = Inspector.CurrentItem
            'Set a = objMail.Class ' uncomment to trigger an error (for debugging)
            Do While objMail.Sent = False
                Sleep 3000 ' param is in ms
                MessageBox &0, "Unsent message! " & objMail.Subject, "Unsent Mail", vbOKOnly ' this is like MsgBox but doesn't lock up Outlook
            Loop
        End If
        Set objMail = Nothing
    End Sub

Posting Permissions

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