I frequently want to change the sender data in the currently open Mail This is well done by following code:
Dim oMail As Outlook.MailItem
Set oMail = ActiveInspector.CurrentItem
oMail.SentOnBehalfOfName = "[email protected]"
Only question / disadvantage is: After running that macro I can not see that the sender is set as desired. For this I'd like to refresh the visible Mail (inspector window)
Best How To :
To make the From label show the right value, you need to set the PR_SENT_REPRESENTING_EMAIL_ADDRESS property (DASL name
http://schemas.microsoft.com/mapi/proptag/0x0065001F) using MailItem.PropertyAccessor.SetProperty.
As a test, you can try to run the following script from OutlookSpy - create a new message in Outlook, click "Script" button on the OutlookSpy Ribbon in the message inspector, paste the script below, click Run:
set Msg = Application.ActiveInspector.CurrentItem
Msg.PropertyAccessor.SetProperty "http://schemas.microsoft.com/mapi/proptag/0x0065001F", "[email protected]"