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

Posted on 2011-03-17
Last Modified: 2012-05-11
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.

Question by:nicksbell
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
LVL 76

Accepted Solution

David Lee earned 500 total points
ID: 35156153
Hi, nicksbell.

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

olkMsg.SentOnBehalfOfName = "Some Name"

will work.

Author Closing Comment

ID: 35156296
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.

Expert Comment

by:Russell Lucas
ID: 35156306
I think you use the .SenderEmailAddress property of the mail object.


obj.SenderEmailAddress = ""
LVL 76

Expert Comment

by:David Lee
ID: 35156335
You're welcome.

Author Comment

ID: 35156358
SenderEmailAddress is a read-only property.  But its fine, as long as it goes from the right address I'm good.

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question