Results 1 to 2 of 2
  1. #1
    Lurker
    Join Date
    May 2015
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Code to send email from secondary account

    Hi,

    I am having trouble with the below code.
    ActiveWorkbook.EnvelopeVisible = True

    Sub Send_Range()

    ActiveSheet.Range("A2:O30").Select
    With ActiveSheet.MailEnvelope
    .Item.From = "FOGHelpdesk@quotientclinical.com"
    .Introduction = "Hello FOG," & vbNewLine & vbNewLine & "See summary below for upcoming equipment maintenance activities." & vbNewLine & "For a detailed view of upcoming work, please open and check the Equipment Database." & vbNewLine & vbNewLine & "Thanks," & vbNewLine & "Equipment Database."
    .Item.To = "gareth.fox@quotientclinical.com"
    .Item.Subject = "Equipment Database Workload"
    .Item.Send
    End With
    End Sub


    I need to get the macro to send the email from a secondary account when a button is pressed within an Excel spreadsheet. The above code works fine without the bold and italic line in place.

    Any ideas?

    Thanks,
    Gareth

  2. #2
    Gold Lounger Maudibe's Avatar
    Join Date
    Aug 2010
    Location
    Pa, USA
    Posts
    2,629
    Thanks
    114
    Thanked 644 Times in 588 Posts
    Gareth,

    "From" does not appear to be a member of the MailEnvelope class. I can access my address book from the From: field in the envelope window but do not know how to access it programmatically. Of course, the macro recorder picks nothing up when attempting it. My standard code that I use to send emails directly from Excel is almost identical but never had the need to change the From: field.

    I know this can be done with an Exchange account or the Mailitem.Sender Property but have never attempted it.

    Sorry I could not help,
    Maud

Posting Permissions

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