VBA - Send email from specified email address

RachW

New Member
Joined
Jun 28, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have created a VBA that works really well, with the exception of the Email_Send, I need it to send from a different email address (that I have access to), however it just continues to send from mine... help!

Code below:

Private Sub CommandButton1_Click()
On Error Resume Next

Dim x As Integer
x = 13

Do While x < 2000

If Range("R" & x).Value = "Yes" Then

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 = "Welcome Back - " & Range("B" & x).Value
Email_Send_From = "differentaddress@help.com.au"
Email_Send_To = Worksheets("Current List").Range("P" & x).Value
Email_Body = "TO: " & Range("B" & x).Value & " and Crew" & Worksheets("Email").Range("A1").Value

On Error GoTo debugs
Set Mail_Object = CreateObject("Outlook.Application")
Set Mail_Single = Mail_Object.CreateItem(0)
With Mail_Single
.Subject = Email_Subject
.To = Email_Send_To
.cc = Email_Cc
.BCC = Email_Bcc
.body = Email_Body
.sent
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description


y = Range("S" & x).Value
Worksheets("Master").Range("C" & y).Value = Worksheets("Current List").Range("B2").Value

Else

End If
x = x + 1
Loop

End Sub
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Look at the sent on behalf of name used in example.

 
Upvote 0

Forum statistics

Threads
1,223,236
Messages
6,170,917
Members
452,366
Latest member
TePunaBloke

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