View Single Post
 
Old 03-14-2012, 09:10 AM
sunnyshiny06 sunnyshiny06 is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Mar 2012
Posts: 1
sunnyshiny06 is on a distinguished road
Default vba outlook change SaveSentMessageFolder

Hello,

Ive two accounts, so users can change their account in a new mail on the from button.
I would like in vba change the "sent item" folder by default always use the same. Weather an user use "account A" or "account B" that mail sent go always on the "sent mail" folder of "account A".

My code is like that :
Dim MyMail As MailItem, _
olkInspector As Outlook.Inspector, _
olkSendThroughBtn As CommandBarPopup, _
olkSendAccount As CommandBarButton, _
mpf As Outlook.Folder, _
mpfInbox As Outlook.Folder

Set MyMail = Application.CreateItem(olMailItem)
MyMail.BodyFormat = olFormatPlain
MyMail.Body = ""
MyMail.Display
Set mpfInbox = Application.Session.GetDefaultFolder(olFolderSentM ail)
Set mpf = mpfInbox.Folders.Item("Sent Itemps")

Set MyMail.SaveSentMessageFolder = mpfInbox

The thing is if they change the from to "Account B" the sent item is changed on sent Items from the "Account B" not from the "Account A".

Any idea?
Maybe i need to update insated the code in Private Sub Application_ItemSend ???
Thanks
Reply With Quote