Taming Outlook
Chris Kunicki’s recent blog entry (https://blogs.officezealot.com/MT/mt-tb.cgi/159) on taming Outlook reminded me of a little modification I made to Outlook to get a specific behavior I liked.
Outlook 2003 has the cool feature for flagging items for follow up. That’s funky, but before I had 2003 I wanted a similar kind of thing: a way to take a mail message and quickly turn it into a task in a way I wanted. Even though I now use the flagging feature, I still use my little sub for some items. Essentially, this procedure takes the selected mail message, creates a new task, extracts the mail contents and puts them in the task notes.
I added a button to the toolbar that maps to my sub.
Public Sub AddToTasks()
Dim olTask As Outlook.TaskItem
Dim olMail As MailItem
Dim olIns As Inspector
Dim olExp As Explorer
Set olTask = Application.CreateItem(olTaskItem)
Set olExp = Application.ActiveExplorer
If olExp.CurrentView <> "Messages" Then Exit Sub
If olExp.Selection.Count <> 1 Then Exit Sub
Set olMail = olExp.Selection.Item(1)
With olTask
.Subject = olMail.Subject
.Body = olMail.Body
.StartDate = Now
.DueDate = DateAdd("d", 7 - Format$(Date, "w", vbSaturday), Date)
.ReminderSet = False
olTask.Status = olTaskInProgress
End With
Set olIns = olTask.GetInspector
olIns.Display ("True")
End Sub
This needs to go in the ThisOutlookSession. I added no error handling, and I made some assumptions about my current view and so on. I can do that when it is just for my machine!
What strikes me is how easily these kinds of things can be done. We really begin to take it for granted that we can customize Office in such an awfully easy way. It’s when we get down to the secret MAPI properties that things get ethereal.
Check out the Office Developer Center at https://msdn.microsoft.com/office
Rock on