How do I change the From field when sending an Outlook message from Access?

I have multiple POP accounts in Outlook (under a single profile).  How do I send an Outlook message and change the from field from Access.

Here is the code I'm trying to use...

Set ola1 = New Outlook.Application

Dim oAccount As Outlook.Account
    For Each oAccount In ola1.Session.Accounts
    MsgBox oAccount.DisplayName
        If oAccount.AccountType = olPop3 Then
          If oAccount.DisplayName = "john@smith.com" Then
               'We found the correct Account
               Exit For
          End If
        End If
    Next
   
Set m = ola1.CreateItem(olMailItem)
m.SendUsingAccount = oAccount
m.Subject = "subject here"
If bolHTML = True Then
    m.HTMLBody = "hello1"
Else
    m.Body = "hello2"
End If


m.Display
pderingAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Jeffrey CoachmanMIS LiasonCommented:
There are a few ways:
If you are using exchange, you can use "SendOnBehalfOf" (*only if you are assigned a delegate for this users account)
This will still let the recipient know that you are only delegated to send this email.

    YourEmailObject..SentOnBehalfOfName = "SomeOneElsesEmailAddress"


There is also "SendAs", ...but I am not sure if you can do this via VBA.
This makes it look like you ARE the sender.

But *obviously* you cannot SendAs anyone you like without the required permissions..

see here for more info:
http://www.ucl.ac.uk/isd/staff/mail/live/outlook/2010/messages/send-differences

Also see here for all things Outlook VBA:
http://www.outlookcode.com/

JeffCoachman
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Applications

From novice to tech pro — start learning today.