ForumsTips & TricksOutlook Macros for Toodledo


Outlook Macros for Toodledo
Author Message
Rich

Posted: Jul 17, 2009
Score: 0 Reference
Now that you can sink TD to Outlook, I created a few macros to help organize the tasks a bit better. The one problem I have with the web interface is how to change multiple tasks at once. With Outlook, this is easy, as it only takes a CTRL click for each task you want to change.

All these macros should be pasted in a module in the VBA application (after pushing ALT+F11)
Rich

Posted: Jul 17, 2009
Score: 0 Reference
Change tags for selected tasks

Public Sub TagTasks()
Dim objItem As TaskItem
Dim myOlExp As Outlook.Explorer
Dim objItems As Outlook.Selection

myInput = InputBox("Change Selected Tags:", "Task Tags")

If myInput <> "" Then

Set myOlExp = Application.ActiveExplorer
Set objItems = myOlExp.Selection

If objItems.Count = 0 Then
Exit Sub
End If

For Each objItem In objItems
If objItem.Class = olTask Then
Set req = objItem.UserProperties.Find("tdtag")
If req Is Nothing Then
Set req = objItem.UserProperties.Add("tdtag", olText)
End If
objItem.UserProperties.Find("tdtag") = myInput
objItem.Save
End If
Next
Set objItems = Nothing
End If
End Sub
Rich

Posted: Jul 17, 2009
Score: 0 Reference
Change context of selected tasks

Public Sub ConTasks()
Dim objItem As TaskItem
Dim myOlExp As Outlook.Explorer
Dim objItems As Outlook.Selection

myInput = InputBox("Change Selected Contexts:", "Task Contexts")

If myInput <> "" Then

Set myOlExp = Application.ActiveExplorer
Set objItems = myOlExp.Selection

If objItems.Count = 0 Then
Exit Sub
End If

For Each objItem In objItems
If objItem.Class = olTask Then
Set req = objItem.UserProperties.Find("tdcontext")
If req Is Nothing Then
Set req = objItem.UserProperties.Add("tdcontext", olText)
End If
objItem.UserProperties.Find("tdcontext") = myInput
objItem.Save
End If
Next

Set objItems = Nothing
End If
End Sub
Rich

Posted: Jul 17, 2009
Score: 0 Reference
Find Duplicate Tasks (all duplicates will have Mileage tag marked)

Public Sub deleteduplicatetasks()
Dim oldTask As TaskItem, newTask As TaskItem, j As Integer
Set myNamespace = GetNamespace("MAPI")
Set myfolder = myNamespace.GetDefaultFolder(olFolderTasks)
Set myItems = myfolder.Items
myItems.Sort "Subject", olDescending
totalcount = myItems.Count
j = 1
While ((j < totalcount) And (myItems(j).Class <> olTask))
j = j + 1
Wend
Set oldTask = myItems(j)
For I = j + 1 To totalcount
If (myItems(I).Class = olTask) Then
Set newTask = myItems(I)
'if((newcontact.lastmodificationtime = oldcontact.lastmodificationtime) and
If ((newTask.Categories = oldTask.Categories) And _
(newTask.Subject = oldTask.Subject) And _
(newTask.DueDate = oldTask.DueDate)) Then
newTask.Mileage = "DELETEMESEYMOUR"
newTask.Save
End If
Set oldTask = newTask

End If
Next I
End Sub
You cannot reply yet

U Back to topic home

R Post a reply

To participate in these forums, you must be signed in.