Results 1 to 7 of 7
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    setting from in an email (visual basic)

    Is there a way to edit the code below to set who the email is from? The from in the email would be the same email address everytime. Obviuosly .from does not work. Any ideas? Thanks...

    Set objDoc = objWord.Documents.Open("c:tempword.doc")
    With objDoc.MailEnvelope.Item
    .To = Nz(srt, "")
    .Subject = strSubject
    '.From = "something@aol.com" Set emai address
    .Send

  2. #2
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: setting from in an email (visual basic)

    Outlook does not let you set the sendername (because of SPAM) but will let you set the sentonbehalfofname if you have appropriate permissions.
    Regards,
    Rory

    Microsoft MVP - Excel

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: setting from in an email (visual basic)

    Is there a way to allow outlook to open before sending the email and allow the user to set the from and the send the email? Even if they had to press the send button that would be ok..

    With objDoc.MailEnvelope.Item
    .To = Nz(srt, "")
    .Subject = strSubject
    .SentOnBehalfOfName = "gbanks@ets.org"
    .Attachments.Add "c:tempword.doc"
    .Send

    End With

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

    Re: setting from in an email (visual basic)

    No, we already tried .Display and that didn't work.

    You might go back to automating Outlook - would it be OK to send the Word doc as attachment?

  5. #5
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: setting from in an email (visual basic)

    Tried that and they wern't thrilled with it. I could add the text to a table like you mentioned earlier but how do I format it like a letter like they want?

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

    Re: setting from in an email (visual basic)

    It's getting to be too complicated.

    If you want to send an e-mail based on a Word document, you have to send it from within Word, but as far as I can tell there is no way to set the From address automatically. You could create and display the document and let the user send it manually.

    On the other hand, if it's OK to send an unformatted message, you can use Outlook automation and set the SentOnBehalfName etc.

  7. #7
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    294
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: setting from in an email (visual basic)

    Hey Hans. I just wanted to give you an update. I was able to get this working uusing sentonbehalfof. Once I got the permissions straightened out with the group mailbox I was good to go. As always thanks for you help and thank to all whp post answers to postings on this board. It really is a god send.

Posting Permissions

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