Hi all,
I've got the below code to generate an outlook email in VBA, how would I define what goes into the "From" field in the email?
Ta!
I've got the below code to generate an outlook email in VBA, how would I define what goes into the "From" field in the email?
Ta!
Code:
Sub SendEmail(address As String, Subject As String, Body As String)
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.From = "mailbox@me.com"
.To = address
.CC = ""
.BCC = "mailbox@me.com"
.Subject = Subject
.Body = Body
' .Attachments.Add ActiveWorkbook.FullName
' .Attachments.Add ("")
.Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub