Sending Email with Multiple Mailboxes Setup in Outlook

JenkinsM82

New Member
Joined
May 17, 2018
Messages
9
Hi Everyone! I'm struggling with some Excel VBA and was wondering if anyone had any suggestions for me. I'm using the code below to send out email. It works great except for people who have multiple email profiles setup in Outlook. I was trying to set Email_Send_From as one of the "from" email address, but it always defaults to the primary email account in Outlook.

Code:
    Dim Email_Subject, Email_Send_From, Email_Send_To, Email_Cc, Email_Bcc, Email_Body As String
    Dim Mail_Object, Mail_Single As Variant
    Email_Subject = "Subject"
    Email_Send_From = "[MY EMAIL ADDRESS]"
    Email_Send_To = Sheets("Order").Range("email").Value
    Email_Cc = ""
    Email_Bcc = ""
    Email_Body = "Email Body"
    On Error GoTo ErrorHandler
    Set Mail_Object = CreateObject("Outlook.Application")
    Set Mail_Single = Mail_Object.CreateItem(0)
    With Mail_Single
        .Display
        .Subject = Email_Subject
        .To = Email_Send_To
        .cc = Email_Cc
        .BCC = Email_Bcc
        '.From = Email_Send_From
        .HTMLBody = Email_Body & .HTMLBody
        .Attachments.Add ("File Path")
    End With
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,649
Messages
6,120,728
Members
448,987
Latest member
marion_davis

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top