![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
I am trying to create a process where when I send a message that I
want to be sure to follow up on, I cc myself on the message. I want to then take that incoming message, copy it to a task and populate certain fields on the task, then delete the message. I am currently trying to run the script after a rule identifies the message. If there is a better way of doing it, I'm open to suggestions. Below is the script I have, but it's not working, and I can't figure out what the problem is. Any help would be appreciated. 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(" 00000000FB410B46958BD711B21100805FA730C90100F8C990 7DFE3BD611B20400805FA730C90000064BAD4F0000") 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(" 00000000FB410B46958BD711B21100805FA730C90100F7CBF6 1AE174914C9E364B416FA0A91600000154A1DB0000") ti.Save End Sub |
Ads |
#2
|
|||
|
|||
![]()
What specifically isn't working?
-- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumpstart for Power Users and Administrators http://www.outlookcode.com/article.aspx?id=54 "Murphybp2" wrote in message ... I am trying to create a process where when I send a message that I want to be sure to follow up on, I cc myself on the message. I want to then take that incoming message, copy it to a task and populate certain fields on the task, then delete the message. I am currently trying to run the script after a rule identifies the message. If there is a better way of doing it, I'm open to suggestions. Below is the script I have, but it's not working, and I can't figure out what the problem is. Any help would be appreciated. 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(" 00000000FB410B46958BD711B21100805FA730C90100F8C990 7DFE3BD611B20400805FA730C90000064BAD4F0000") 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(" 00000000FB410B46958BD711B21100805FA730C90100F7CBF6 1AE174914C9E364B416FA0A91600000154A1DB0000") ti.Save End Sub |
#3
|
|||
|
|||
![]()
You could use the ItemSend event to grab a copy of the message and
copy it to your default Tasks folder (which would turn it into a task). For example: Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean) Dim objNS As NameSpace Dim TaskFldr As MAPIFolder Dim recip As Recipient Set objNS = Application.GetNamespace("MAPI") Set TaskFldr = objNS.GetDefaultFolder(olFolderTasks) If TypeName(Item) = "MailItem" Then Set Msg = Item For Each recip In Msg.Recipients If recip.Name = "Jimmy Pena" Then Set mymsg = Msg.Copy mymsg.Move TaskFldr End If Next recip End If HTH, JP On Jan 3, 2:05*pm, Murphybp2 wrote: I am trying to create a process where when I send a message that I want to be sure to follow up on, I cc myself on the message. *I want to then take that incoming message, copy it to a task and populate certain fields on the task, then delete the message. *I am currently trying to run the script after a rule identifies the message. *If there is a better way of doing it, I'm open to suggestions. *Below is the script I have, but it's not working, and I can't figure out what the problem is. *Any help would be appreciated. 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(" 00000000FB410B46958BD711B*21100805FA730C90100F8C99 07DFE3BD611B20400805FA730C90000064BAD4F0000") * * 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(" 00000000FB410B46958BD711B*21100805FA730C90100F7CBF 61AE174914C9E364B416FA0A91600000154A1DB0000") ti.Save End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Creating an Outlook Task with VB Script | Pegasus \(MVP\) | Outlook and VBA | 3 | November 28th 07 10:06 PM |
Task shortcuts (not copies of Tasks) in Calendar Appointments (for the Microsoft Office development team) | Mark Davies | Outlook - General Queries | 2 | February 14th 07 03:48 PM |
How do I script to change the subject line of incoming mail? | D-Man | Outlook and VBA | 3 | January 29th 07 07:12 PM |
script to clear out categories on incoming emails | [email protected] | Outlook and VBA | 2 | July 31st 06 07:17 PM |
Receive multi-copies of incoming emails? | wendystation | Outlook - Using Contacts | 9 | May 3rd 06 02:27 PM |