How do I change the FROM address in Outlook 2007 using VBA

I have written some VBA code to send an email from Excel 2007 using Outlook.Application and Outlook.MailItem.  My outlook is set up to access my exchange account but I have Send As permission to send from another account.  

Can anyone tell me how to change the From field to the Send As address using VBA.

Who is Participating?

Improve company productivity with a Business Account.Sign Up

David LeeConnect With a Mentor Commented:
Hi, nicksbell.

Assuming that your message is in an object named olkMsg, then

olkMsg.SentOnBehalfOfName = "Some Name"

will work.
nicksbellAuthor Commented:
I had tried that but when the email was displayed the From box was blank so I assumed it didn't work.  However, after your reply I tried sending it and low and behold it worked.

Thanks for your help.
Russell LucasIT Infrastructure Project ManagerCommented:
I think you use the .SenderEmailAddress property of the mail object.


obj.SenderEmailAddress = ""
David LeeCommented:
You're welcome.
nicksbellAuthor Commented:
SenderEmailAddress is a read-only property.  But its fine, as long as it goes from the right address I'm good.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.