I found the code I need to make this work, but I'm having difficutly assigning a button to this code AND making it run.. I'm using office 2k3, anyone mind helping me get this working so I can just highlite a message, click the button, and get it all going?
Here is the code I have:
[VBA]Public Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
Dim objTask As Outlook.TaskItem
Set objTask = Application.CreateItem(olTaskItem)
With objTask
.Subject = MyMail.Subject
.DueDate = MyMail.SentOn
.Body = MyMail.Body
End With
If MyMail.Attachments.Count > 0 Then
Call CopyAttachments(MyMail, objTask)
End If
objTask.Save
Set objTask = Nothing
End Sub
Sub CopyAttachments(objSourceItem, objTargetItem)
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldTemp = fso.GetSpecialFolder(2) ' TemporaryFolder
strPath = fldTemp.Path & "\"
For Each objAtt In objSourceItem.Attachments
strFile = strPath & objAtt.FileName
objAtt.SaveAsFile strFile
objTargetItem.Attachments.Add strFile, , , objAtt.DisplayName
fso.DeleteFile strFile
Next
Set fldTemp = Nothing
Set fso = Nothing
End Sub
[/VBA]