Expand Cut Tags

No cut tags
ximinez: (code monkey)
[personal profile] ximinez
I just wrote this up for work, but it seems like the kind of thing that might be useful to others, and that they wouldn't mind me sharing with friends, so I'm posting a copy here too. (Plus, it might be good for future reference, if you know what I mean...)

Introduction

Apparently, there are some people in this world who are are able to perform certain tasks automatically:
  • Knowing what time it is.
  • Remembering that they have a meeting at a given time in the future.
  • Realizing when that time has arrived and actually going to that meeting.
I, personally, am incapable of doing any of these things. So, I rely on tools like Outlook and my Comm / PDA / Smartphone to do them for me. (Well, all but actually going to the meeting. I still have to do that myself, but the Comm does remind me of it.)

Unfortunately, Outlook has this annoying feature (more like a design flaw) that sets the reminder on an incoming event invitation based on the sender's preferences instead of mine, and not alerting me when they differ. So I get an invitation, happily accept it, with every intention of attending, then blithely forget to actually go, because no alert was triggered, because no reminder was on the original invitation.

("But," you ask, "can't you change the reminder settings to whatever you want when you get the invitation?" Yes, yes I can, but I don't remember that earlier. Let's add that one to the list of stuff I can't do:
  • Remembering to check the reminder settings of all incoming meeting invitations.
And move on.)
Finally, I've put together a working solution...

Set up a custom VB script to ensure every future appointment has a reminder

This involves a little bit of mucking around with Outlook's internals, but don't worry. I'll be gentle.
  1. In Outlook, go to the Tools menu, then select Macro, then Visual Basic Editor. Or just hit Alt+F11.
    • This will open the Microsoft Visual Basic For Applications Especially Outlook editor thingy.
  2. There will be a tree in the left pane. Look for Project1 -> Microsoft Office Outlook -> ThisOutlookSession. Right-click on ThisOutlookSession and choose View Code.
    • You will be presented with an empty text editor window.
  3. Into that window, paste the following code:
Sub PutAReminderOnEveryCalendarAppointment(Item As Outlook.MailItem)

  ManuallyPutAReminderOnEveryCalendarAppointment

End Sub

Sub ManuallyPutAReminderOnEveryCalendarAppointment()

   Const olFolderCalendar = 9
   
   Set objOutlook = CreateObject("Outlook.Application")
   Set objNamespace = objOutlook.GetNamespace("MAPI")
   Set objFolder = objNamespace.GetDefaultFolder(olFolderCalendar)
   Set colItems = objFolder.Items
   
   strFilter = "[ReminderSet] = False AND [Start] >= '" & DateTime.Date & "'"
   'MsgBox strFilter
   
   Set objItem = colItems.Find(strFilter)
   
   While Not objItem Is Nothing
       objItem.ReminderSet = True
       objItem.ReminderMinutesBeforeStart = 15
       objItem.Save
       
       'MsgBox "Set a " & objItem.ReminderMinutesBeforeStart & " minute reminder on " & objItem.Subject & " @ " & objItem.Start
       
       Set objItem = colItems.FindNext
   Wend

End Sub
  • Finally, save your script (Ctrl-S) and close the VBA window (Alt-F4).
(Note that there are a few MsgBox lines commented out (starting with the ' character) in this script. Feel free to uncomment them or make other modifications if you want to see the script in action.)

Running your custom VB script

Ok, you've got this script, why do your appointments still not have reminders? If the name of this section wasn't a hint, it's because you need to actually run it. There are two ways to do this. Which you use and when is up to you.

Running the script manually

The first time you set this up, maybe on occasions where you suspect a problem, and if you don't want it running automatically, the script can be run manually.
  1. Go to the Tools menu, then Macro, then Macros (or hit Alt+F8).
  2. You'll get a dialog box with the list of available scripts.
  3. Select the one named ThisOutlookSession.ManuallyPutAReminderOnEveryCalendarAppointment, and click the Run button.
That's it!

Running the script automatically

Unfortunately, Outlook doesn't have any kind of "scheduler" (so far as I've found) that'll let you run this script automatically, but we can get the next best thing by piggy-backing on an event that occurs fairly often: receiving email.
  1. Go to the Tools menu, then select Rules and Alerts....
  2. If you already have rules and want to modify one of them, skip ahead a couple of steps. Otherwise, click the New Rule... button.
  3. Select Start from a blank rule, then Check messages when they arrive, then click the Next > button.
  4. On the Which condition(s) do you want to check? screen, you need to decide how often you want the script to run. Rule configuration is beyond the scope of this document. If in doubt, don't select any of the conditions, so the script will be run with every incoming email. Warning: running the script with every incoming email may effect your system performance.
  5. When you're done with this screen, click the Next > button.
  6. On the What do you want to do with the message? screen, select the option (near the end of the list) named "run a script".
  7. In the Step 2: Edit the rule description (click an underlined value), click the link inside run a script.
    • You'll get a select script dialog box.
  8. Select the one named Project1.ThisOutlookSession.PutAReminderOnEveryCalendarAppointment, and click the Ok button. Then click the Next > button.
  9. Configure any exceptions you'd like, but this configuration is also beyond the scope of this document.
  10. When you're done with this screen, click the Next > button.
  11. On the final Finish rule setup screen, enter a name for the rule (or use the default), and ensure the Run this rule now box is unchecked, and the Turn on this rule box is checked. Then click the Finish button.
Notes and known issues
  • To prevent you from getting 80 bajillion notifications of overdue appointments the first time you run this script, it only looks at appointments that start on or after today. As a side effect of this, any recurring appointments that start before today, but continue after today will be ignored. I consider this a good thing as it allows you to mark blocks of time as "don't schedule meetings for me during my lunch / my class / my workout" without requiring you to put a reminder on it - just start it before today.
    • The downside, of course, is that if you have any existing recurring appointments that you want to put reminders on, you're going to have to do that manually.
  • If you've already missed a reminderless appointment for a given day when the script first runs for that day (maybe somebody called a last minute morning meeting, and you were late because you didn't know about it), you'll get an overdue appointment notification when the script runs. There is some strange, inconsistent behavior that occurs if you hit Dismiss, the reminder is sometimes removed from the appointment. And then it happens again next time the script runs. I don't understand it either, but you can prevent it by closing the notification window with Alt+F4 or the big "X" button in the corner instead.
References

This information was cobbled together from a few different sources. Here's a list of them.
From:
Anonymous( )Anonymous This account has disabled anonymous posting.
OpenID( )OpenID You can comment on this post while signed in with an account from many other sites, once you have confirmed your email address. Sign in using OpenID.
User
Account name:
Password:
If you don't have an account you can create one now.
Subject:
HTML doesn't work in the subject.

Message:

 
Notice: This account is set to log the IP addresses of everyone who comments.
Links will be displayed as unclickable URLs to help prevent spam.

February 2017

S M T W T F S
   1 234
567891011
12131415161718
19202122232425
262728    

Most Popular Tags

Style Credit

Page generated Sep. 19th, 2017 06:58 pm
Powered by Dreamwidth Studios