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

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
.
Ron wrote the 'bible' on VBA email.
 
Upvote 0

Forum statistics

Threads
1,223,677
Messages
6,173,780
Members
452,534
Latest member
autodiscreet

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