Hi all,
I have got some code that generates a new email as i want. The only problem is the FROM element.
In outlook i am connected to 4 Inbox's.
By default my Outlook is connected to MY personal works email address. But I need the email to be sent from the department email address.
So even though im putting the department email address in the - Email_Send_From = "DEPARTMENT EMAIL ADDRESS", it is still sending from MY personal email address.
At the minute when the email is generated I have to select the "FROM" dropdown and select the department email address.
Can anyone help?
Option Explicit
Sub Send_Email_Using_VBA()
Dim Email_Subject, Email_Send_From, Email_Send_To, _
Email_Cc, Email_Bcc, Email_Body As String
Dim Mail_Object, Mail_Single As Variant
Dim nRow As Long
nRow = ActiveCell.Row
Email_Subject = "Trying to send email using VBA"
Email_Send_From = "DEPARTMENT EMAIL ADDRESS"
Email_Send_To = Range("D" & nRow).Value
Email_Body = "Congratulations!!!! You have successfully sent an e-mail using VBA !!!!"
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
.Body = Email_Body
.Display
'.send
End With
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub
Bookmarks