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

Posted on 2011-03-17
Medium Priority
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 2000 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 = "someone@example.com"
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Question has a verified solution.

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

Outlook for dependable use in a very small business   This article is about using the Outlook application (part of Microsoft Office) in a very small business, or for homeowners where dependability and reliability are critical requirements. This …
If you need to forecast numbers -- typically for finance -- the Windows and Mac versions of Excel 2016 have a basket of tools to get the job done.
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…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Suggested Courses

765 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