M
Murphybp2
I am trying to create a process that will automatically create a task
from an incoming email message. My current approach uses a rule to
identify an email I have sent to myself, then runs a VBA Script.
Problem is I can't get the script to work, and am not skilled enough
to figure out why it is not working. If anyone can tell me what I
need to change to get it to work that would be great. Also, if
someone has a better approach, I'm open to suggestions. Thanks.
Sub CopyIncomingEmailtoWaitingForTask(Item As Outlook.MailItem)
'Use this to tie to a Rule that automatically creates task for Waiting
Items on Incoming items I copied myself on
Dim olmailitem As Outlook.MailItem
Dim ti As TaskItem
Dim fldCurrent As MAPIFolder
Set fldCurrent =
Application.GetNamespace("MAPI").GetFolderFromID("00000000FB410B46958BD711B21100805FA730C90100F8C9907DFE3BD611B20400805FA730C90000064BAD4F0000")
Set ti = fldCurrent.Items.Add
ti.Body = olmailitem.Body & vbCrLf & vbCrLf
ti.Attachments.Add MailItem
ti.Subject = olmailitem.SenderName & olmailitem.Subject &
olmailitem.SentOn
ti.Categories = "@Waiting For"
olmailitem.Move
Application.GetNamespace("MAPI").GetFolderFromID("00000000FB410B46958BD711B21100805FA730C90100F7CBF61AE174914C9E364B416FA0A91600000154A1DB0000")
ti.Save
End Sub
from an incoming email message. My current approach uses a rule to
identify an email I have sent to myself, then runs a VBA Script.
Problem is I can't get the script to work, and am not skilled enough
to figure out why it is not working. If anyone can tell me what I
need to change to get it to work that would be great. Also, if
someone has a better approach, I'm open to suggestions. Thanks.
Sub CopyIncomingEmailtoWaitingForTask(Item As Outlook.MailItem)
'Use this to tie to a Rule that automatically creates task for Waiting
Items on Incoming items I copied myself on
Dim olmailitem As Outlook.MailItem
Dim ti As TaskItem
Dim fldCurrent As MAPIFolder
Set fldCurrent =
Application.GetNamespace("MAPI").GetFolderFromID("00000000FB410B46958BD711B21100805FA730C90100F8C9907DFE3BD611B20400805FA730C90000064BAD4F0000")
Set ti = fldCurrent.Items.Add
ti.Body = olmailitem.Body & vbCrLf & vbCrLf
ti.Attachments.Add MailItem
ti.Subject = olmailitem.SenderName & olmailitem.Subject &
olmailitem.SentOn
ti.Categories = "@Waiting For"
olmailitem.Move
Application.GetNamespace("MAPI").GetFolderFromID("00000000FB410B46958BD711B21100805FA730C90100F7CBF61AE174914C9E364B416FA0A91600000154A1DB0000")
ti.Save
End Sub