Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Late Task Notice (2003)

    I'd like to setup a macro that send out an e-mail notice to my boss whenever a task in one category of my task list is overdue. I don't write VBA and there's no macro recorder in Outlook. The e-mail message only needs to identify the task subject line and will always be sent to the same e-mail address. Can anyone help with this?

  2. #2
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    Is there a prize for stumping the experts?

  3. #3
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    No. <img src=/S/smile.gif border=0 alt=smile width=15 height=15> The "experts" mostly have other jobs, and a request such as yours takes a little time, so be patient. You could provide a little more detail about what information you want sent, when it should be sent and how you want it sent - your original request is pretty general.
    -John ... I float in liquid gardens
    UTC -7ąDS

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    My profound apologies to the MASTERS. I falsely assumed someone would simply point me in the right direction. But no, you went above and beyond by actually crafting the entire solution. Many, many thanx. I'll be out of the office today and won't be able to test it out until Monday. Thanx again and have a great weekend.

  5. #5
    Super Moderator WebGenii's Avatar
    Join Date
    Jan 2001
    Location
    Redcliff, Alberta, Canada
    Posts
    4,066
    Thanks
    2
    Thanked 5 Times in 5 Posts

    Re: Late Task Notice (2003)

    Hi John
    I'm curious about this solution/problem.
    could you do something similar to trigger your rules to run? Although I see that rules only run against mail items - not tasks
    (but don't write anything John - this is a mental exercise only)
    [b]Catharine Richardson (WebGenii)
    WebGenii Home Page
    Moderator: Spreadsheets, Other MS Apps, Presentation Apps, Visual Basic for Apps, Windows Mobile

  6. #6
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    Catharine, through Outlook 2003, Rules are not exposed in the Outlook Object Model, so there's no way for code to trigger a Rule. OTOH, Rules can call code ("run a script") - there are a few examples of doing that in the Forum - but only on message items.

    Other code approaches include hooking the Item_Add Event, which gives you considerable flexibility. The code above hooks the Reminder Event.
    -John ... I float in liquid gardens
    UTC -7ąDS

  7. #7
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    I tried setting up a test scenario, but it didn't appear to trigger.

  8. #8
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    Do you set Due Date reminders on your Tasks? The code requires that you do. Also to test that you are using a valid Category name instead of "DaBoss".
    -John ... I float in liquid gardens
    UTC -7ąDS

  9. #9
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    The category is set as "audit" and I set the date to 11.20.08.

    Although I can't write VBA, I can follow the logic most of the time. I don't understand what starts this macro running. Does it run at application startup?

  10. #10
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    Three things:

    The code is triggered by the Reminder event - that's why you need to have the Reminder box checked in the Task, and the Reminder needs to fire some time during the day on the Due Date. Because it triggers as an Event, the code must be in the "ThisOutlookSession" in the Outlook VBE, and the first time you add it to the module, you may need to close and restart Outlook for it to become active.

    There was a syntax error on the ".Recipients" line, now corrected in that post - my mistake. This is now working on my machine on a test basis, using an "audit" Category.

    As I noted above more information would be helpful - the code could trigger on Outlook opening or closing if you prefer, but it will be more complicated.
    -John ... I float in liquid gardens
    UTC -7ąDS

  11. #11
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    This untested code, edited to your category and email recipient will trigger every time you get a Task Reminder on the Due Date and the Task is not marked complete. It needs to be placed in the ThisOutlookSession module of the Outlook VBE; it will do nothing in a standard module.

    Private Sub Application_Reminder(ByVal Item As Object)
    Dim msg As Outlook.MailItem

    With Item
    If .Class = olTask And CBool(InStr(.Categories, "audit")) Then
    If .Status <> olTaskComplete And .DueDate <= Date Then
    Set msg = Outlook.CreateItem(olMailItem)
    With msg
    .Subject = "Overdue task: " & Item.Subject
    .Recipients.Add("daboss@mycompany.com")
    .Save
    .Display ' comment out if you don't want to see it
    '.Send ' uncomment if you want it to send automatically
    End With
    End If
    End If
    End With
    Set msg = Nothing
    End Sub

    As I said, untested - test on a fake Task to see that it works, and post back with the details if fails to fire or errors out.
    -John ... I float in liquid gardens
    UTC -7ąDS

  12. #12
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    Edited by HansV to shrink HUGE screenshot

    The reminder is set and the code is in ThisOutlookSession (see attachment). Even after rebooting, the macro doesn't fire. The reminder window does trigger, but no e-mail.
    Attached Images Attached Images
    • File Type: jpg x.jpg (44.9 KB, 2 views)

  13. #13
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    Please add these two words as the very first line in the ThisOutlookSession in the VBE code window: "Option Explicit", without the quotes, and with a blank line after those words and before any code Subs.

    Your syntax in the .Recipients line is not correct, it should not use an equals sign (and should be throwing an error message), it should be:

    .Recipients.Add("name____@mycompany.com")

    If the code returns an error please report it back. If it doesn't error, but still doesn't fire, in the Outlook VBE turn on the Immediates Window - press Ctrl-G - and enter this additional line in Bold:

    If .Class = olTask And CBool(InStr(.Categories, "audit")) Then
    Debug.Print .Subject & " is a task with Categories: " & .Categories

    Than when you run your Task test, see if the Immediates window shows a message about the item.
    -John ... I float in liquid gardens
    UTC -7ąDS

  14. #14
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Chicago, Illinois, USA
    Posts
    187
    Thanks
    6
    Thanked 0 Times in 0 Posts

    Re: Late Task Notice (2003)

    Thanx, it's working fine now that the macro security level has been reset.

  15. #15
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Salt Lake City, Utah, USA
    Posts
    9,508
    Thanks
    0
    Thanked 6 Times in 6 Posts

    Re: Late Task Notice (2003)

    Sorry, I take that setting for granted. Glad to hear it's working. If you want it to work when you have not set a reminder, let me know.

    Is your boss all over you now about late tasks? <img src=/S/anigrin.gif border=0 alt=anigrin width=19 height=19>
    -John ... I float in liquid gardens
    UTC -7ąDS

Page 1 of 2 12 LastLast

Posting Permissions

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