PDA

View Full Version : Amending Code To Reference value (Email address) In Cell



bloodmilksky
12-07-2016, 03:44 AM
Hi Guys, I hope you are all well.

I was just wondering if anyone knows how I could amend the ".To" part of the below code so it emails the value in a cell range instead of a specific email address.

any help would be greatly appreciated

many thanks

Jamie




With Dest
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.To = Range.Activate("EmplyEmail").Range.Select("EmplyEmail")
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Dest.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
.Close savechanges:=False

mancubus
12-07-2016, 05:29 AM
With Dest
.SaveAs TempFilePath & TempFileName & FileExtStr, FileFormat:=FileFormatNum
On Error Resume Next
With OutMail
.To = Range("EmplyEmail").Value
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.Body = "Hi there"
.Attachments.Add Dest.FullName
'You can add other files also like this
'.Attachments.Add ("C:\test.txt")
.Send 'or use .Display
End With
On Error GoTo 0
.Close savechanges:=False