A revision to the code for the outlook macro to forward an email to Toodledoo
Just a minor update to the existing macro, to determine if the current day is Friday, and to action the item for Monday rather than tomorrow
Code in full:Sub Toodledo()
'Forward the selected email to Toodledo, updating the subject with the appropriate shortcuts and move to appropriate folder
On Error Resume Next Dim objMail As Outlook.MailItem
Dim objItem As Outlook.MailItem Set objItem = GetCurrentItem()
Set objMail = objItem.Forward Dim strWhenToAction
objMail.To = "" 'my toodledo email address
If (DatePart("w", Now) = vbFriday) Then
strWhenToAction = "monday"
Else
strWhenToAction = "tomorrow"
End If objMail.Subject = "Respond to " + objMail.Subject + " @@work #" + strWhenToAction + " *Actioned" 'Prefix with Respond to, and append context of @work, date of tomorrow, and folder of Actioned
objMail.Send Call MoveMessageToFolder(objItem, "Actions") 'move it to my Actions folder 'clean up
Set objMail = Nothing
Set objItem = NothingEnd SubPrivate Function GetCurrentItem() As Outlook.MailItem
'Taken from code sample provided at http://www.pcreview.co.uk/forums/thread-2798274.php
On Error Resume Next Dim objApp As Outlook.Application
Set objApp = Application On Error Resume Next Select Case TypeName(objApp.ActiveWindow)
Case "Explorer"
Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1)
Case "Inspector"
Set GetCurrentItem = objApp.ActiveInspector.CurrentItem
Case Else
End Select 'clean up
Set objApp = Nothing
End FunctionPrivate Sub MoveMessageToFolder(objItem As Outlook.MailItem, ByVal sFolder As String)
'Loosely based on code found at http://verychewy.com/archive/2006/04/12/outlook-macro-to-move-an-email-to-fol...
On Error Resume Next Dim objFolder As Outlook.MAPIFolder
Dim objInbox As Outlook.MAPIFolder
Dim objNS As Outlook.NameSpace Set objNS = Application.GetNamespace("MAPI")
Set objInbox = objNS.GetDefaultFolder(olFolderInbox)
Set objFolder = objInbox.Folders(sFolder) If objFolder Is Nothing Then
MsgBox "This folder doesn't exist!", vbOKOnly + vbExclamation, "INVALID FOLDER"
End If objItem.Move objFolder 'Clean up
Set objFolder = Nothing
Set objInbox = Nothing
Set objNS = Nothing
End Sub
The previous post contains hints on signing macros etc