PDA

View Full Version : Save after send in Personal folder



Dancho
02-01-2012, 03:58 AM
Hi all,
I'm trying to write a macro which picks a folder from personal folders
ans save a mail after it is sent instead of in "sent" box.
The problem is, that it works fine as long as I pick the folder from
Mailbox and not from personal.When I pick a folder from personal
folder, the mail stays in sent items folder.
This is may code:

Public Sub SendAndSave()
Dim obj As Object
Dim Mail As Outlook.MailItem
Dim objOutlook As Outlook.Application
Dim objNamespace As Outlook.NameSpace
Dim fldNew As MAPIFolder


' Create an object for the Outlook application.
Set objOutlook = Application
' Retrieve an object for the MAPI namespace.
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set obj = Application.ActiveInspector.CurrentItem

If TypeOf obj Is Outlook.MailItem Then
Set Mail = obj
Set fldNew = objNamespace.PickFolder()
' Move the mail to the destination folder.
If Not fldNew Is Nothing Then
Set Mail.SaveSentMessageFolder = fldNew
End If
Mail.Save
Mail.Send
End If
Set fldNew = Nothing
Set obj = Nothing
Set Mail = Nothing
Set objNamespace = Nothing
End Sub