N
Nick_NZ
Hi I have a program (thanks to Sue Mosher) that converts emails into tasks,
based on certain words in the subject line. It runs as an Outlook Rule.
It works fine except for the attachments. For some reason the attachments
that are being sent are not being displayed in the task that is generated.
Here is my code:
Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim objTask As Outlook.TaskItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
Set objTask = Application.CreateItem(olTaskItem)
With objTask
.Subject = olMail.Subject
.DueDate = DateAddW(olMail.SentOn, 5)
.ReminderTime = DateAddW(olMail.SentOn, 4)
.Importance = olImportanceHigh
.Body = olMail.Body
.Attachments = olMail.Attachments <-WHERE I'M HAVING TROUBLE!
End With
olMail.Delete
objTask.Save
Set objTask = Nothing
Set olMail = Nothing
Set olNS = Nothing
End Sub
If any one can help here, it would be great!
based on certain words in the subject line. It runs as an Outlook Rule.
It works fine except for the attachments. For some reason the attachments
that are being sent are not being displayed in the task that is generated.
Here is my code:
Sub MakeTaskFromMail(MyMail As Outlook.MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim objTask As Outlook.TaskItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set olMail = olNS.GetItemFromID(strID)
Set objTask = Application.CreateItem(olTaskItem)
With objTask
.Subject = olMail.Subject
.DueDate = DateAddW(olMail.SentOn, 5)
.ReminderTime = DateAddW(olMail.SentOn, 4)
.Importance = olImportanceHigh
.Body = olMail.Body
.Attachments = olMail.Attachments <-WHERE I'M HAVING TROUBLE!
End With
olMail.Delete
objTask.Save
Set objTask = Nothing
Set olMail = Nothing
Set olNS = Nothing
End Sub
If any one can help here, it would be great!