Hello
I have a spreadsheet where it looks up the email address of someone based on the name and then sends an email to that person. A lot of people will be using this spreadsheet but we want it to look like it comes from the same person each time
My code is
Sub Mail_Selection_Range_Outlook_Body()
Dim start As Integer
start = Application.CountIf(Worksheets("Calls").Range("A1:A1005"), "*") + 4
Dim OutApp As Object
Dim OutMail As Object
Call GetAddresses
With Application
.EnableEvents = False
.ScreenUpdating = False
End With
Set OutApp = CreateObject("Outlook.Application")
OutApp.Session.Logon
Set OutMail = OutApp.CreateItem(0)
On Error Resume Next
With OutMail
.To = Cells(start, 7)
.Subject = "Subject"
.Body = Cells(start, 6)
.Display 'or use .Display
End With
On Error GoTo 0
With Application
.EnableEvents = True
.ScreenUpdating = True
End With
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Is there a way to specify the address it is sent from? I've tried:
With OutMail
.From = "address@from.com"
.To = Cells(start, 7)
.Subject = "Call Closure Notification"
.Body = Cells(start, 6)
.Display 'or use .Display
End With
But this doesn't work. is there a command to do this?
Bookmarks