Not long ago, both my personal and business email was managed by Google. Those were the good old days. I had a consistent interface, and more importantly, consistent shortcut keys. Can you guess why I keep refreshing gmail? Now my work email is Outlook and Exchange.
I’ve been setting up some macros in Outlook to try to make it palatable. At least one advantage Outlook has over GMail is VBA. Mostly I can make it do whatever I want. Mostly.
Today I’m starting with an easy one. When I send an email that requires some follow up, I need to get it on GoodTodo. If you’re a GoodTodo user, you know how well it handles email. All I need to do is BCC one of several email addresses and GoodTodo handles the rest. I’m sure most GoodTodo users use the many email addresses GoodTodo offers – you can email to a specific date or a relative date in a variety of syntaxes – but I use today@goodtodo.com exclusively. I just find it easier to get it on today’s list and move it the next time I’m using the list.
To add today@goodtodo to an email I’m composing, I created this simple procedure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
Sub AddTodo() Dim olMi As MailItem Dim olRecip As Recipient If TypeName(ActiveInspector.currentItem) = "MailItem" Then Set olMi = ActiveInspector.currentItem If Not olMi.Sent Then olMi.BCC = "today@goodtodo.com" End If End If End Sub |
Pretty simple. Then I got to thinking (sometimes that happens). Maybe I would use some of the other email syntaxes if they were as handy as “today” is. All of my todo items go in one of a few spots: the specific day it’s due, today, tomorrow, this Saturday (I’d like to get it done this week, but it’s not critical), the last day of the month (I’d like to get it done someday, but let’s face it…). Every Saturday, my list grows and I’m forced to either push the items off another week, do them, or delete them. The same happens at the end of the month. It’s nice way for me to create the list items and encourage myself to review them on a regular basis.
OK, enough of that. With only a few relevant dates, I changed the code to cycle through them. This macro is on the QAT in the second position, so Alt+2 does the deed.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
Sub AddTodo() Dim olMi As MailItem Dim olRecip As Recipient Dim aBcc(1 To 4) As String Dim i As Long Const sDOMAIN As String = "@goodtodo.com" aBcc(1) = "today" aBcc(2) = "tomorrow" aBcc(3) = "saturday" aBcc(4) = Format(DateSerial(Year(Now), Month(Now) + 1, 0), "mmmmd") If TypeName(ActiveInspector.currentItem) = "MailItem" Then Set olMi = ActiveInspector.currentItem If Not olMi.Sent Then If Len(olMi.BCC) = 0 Then olMi.BCC = aBcc(LBound(aBcc)) & sDOMAIN Else For i = LBound(aBcc) To UBound(aBcc) If olMi.BCC = aBcc(i) & sDOMAIN Then If i = UBound(aBcc) Then olMi.BCC = aBcc(LBound(aBcc)) & sDOMAIN Else olMi.BCC = aBcc(i + 1) & sDOMAIN End If Exit For End If Next i End If End If End If End Sub |
Nice little arrow anti-pattern there. And the result.
Nifty! I needed something like this recently. Thanks for the royalty-free code.
Outlook VBA is like that restaurant I’ve always wanted to try, but I never seem to be in the right part of town.
“Can you guess why I keep refreshing gmail?”
No, I can’t, and I’ve been thinking about it for days. I can only assume that you’re typing a “u” expecting something else to happen. But I can’t think why you’d type one all by itself. Plus, if you’ve been using gmail all along, why would you accidentally be doing something in it now that you’ve switched partly to Outlook? Or is this something you’ve been doing all along? Am I misunderstanding the question and it has nothing to do with your switch? Do you just refresh it because it’s easy and you’re expecting an important email?
Please let me know and put me out of my misery.
Ctrl+R is ‘reply’ in Outlook. I keep pressing Ctrl+R in Gmail, which refreshes the page in Firefox.