Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Send Outlook email From-field (Office 2003)

    I have an application in VBA (in Excel) that sends emails to a list of users. This year, I'm managing two email accounts in Outlook and I want to "set the 'From:' field" programmatically.
    I'm using something like

    Set ToContact = .Recipients.Add("name@company.com")

    But how do I populate the "From:" field???

  2. #2
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Send Outlook email From-field (Office 2003)

    OK, I'm working with OL2003 and and Exchange server so I guess I should/could use the "SentOnBehalfName" property... Tried it and I simply don't know how to... Also can't find and example anywhere on the net (I Googled for that name but only see people telling others to use it but not HOW to use it)... sorry for my ignorance here. Appreciate your help.

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Outlook email From-field (Office 2003)

    I assume that you have an object of type MailItem, let's say objMessage, and that you have code of the form
    <code>
    With objMessage
    ...
    End With
    </code>
    Somewhere between With ... and End With, insert a line like
    <code>
    .SentOnBehalfOfName = "John Doe"</code>

  4. #4
    5 Star Lounger
    Join Date
    Jul 2001
    Location
    Terneuzen, Netherlands
    Posts
    895
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Send Outlook email From-field (Office 2003)

    Aahhh, sorry. I missed that and used "SentOnBehalfName" in stead of "SentOnBehalfOfName". Now it works!

  5. #5
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Outlook email From-field (Office 2003)

    That was my mistake, actually <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    I had SentOnBehalfName in my original reply. Sorry about that!

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Send Outlook email From-field (Office 2003)

    Added later: SentOnBehalfName should be SentOnBehalfOfName !

    The SenderName property is read-only for security reasons. You can set the SentOnBehalfName property.
    As a workaround, you can use the Account toolbar button, see OutlookCode.com :: Setting the From (sender) on a message

    (Note: in Outlook 2007, you can set the SendUsingAccount property, but this is not available in earlier versions.)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •