PDA

View Full Version : Copy Sent Msgs to current folder AND Sent folder



vlncheme
05-05-2010, 07:20 AM
I would like to have a copy of the sent message in the Sent folder as well as in the Current folder. I have the following code (borrowed from another site) which does the 1st part by changing the MailItem.SaveSentMessageFolder to the current folder. However, this is only one of the folders I want. I cannot just copy the message as it has not yet been sent and will stay that way until the application itemsend method finished. Here is the code I am using now in a Class Module. Any help would be appreciated.

Private Sub Application_ItemSend(ByVal myItem As Object, Cancel As Boolean)
'get current folder
If TypeName(myItem) = "MailItem" Then
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objFolder As Outlook.Folder
Dim myCopiedItem As Outlook.MailItem
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
Set objFolder = olApp.ActiveExplorer.CurrentFolder
Set myItem.SaveSentMessageFolder = objFolder
'copy msg to objFolder
'Set myCopiedItem = myItem.Copy
'myCopiedItem.Move objFolder
'show message in case copied to wrong folder
MsgBox ("Message w/ sub = " & myItem.Subject & " copied to " & objFolder.Name)
End If
End Sub