Hello,
I have Office 2013, and I am trying to write a macro to send an email from a certain account, but my Email_Send_From doesnt seem to be working. The email sends to who I want it to, and says what I want it to, but it is using the wrong email to send from.
Any help? I have several emails setup on my outlook. I want it to send from my gmail account. I have it setup with imap.
Thank you for the help.
Sub Email_Tenant_1934()
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 = "Hello " & ActiveSheet.Range("B3")
Email_Send_From = "XXXX@gmail.com"
Email_Send_To = ActiveSheet.Range("B5")
Email_Cc = ""
Email_Bcc = ""
Email_Body = "It works!"
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
.send
MsgBox "Mail Has Been Sent"
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub
Bookmarks