I have this code below that when a date is entered an email is sent.
Question 1: If the date is a future date will the email send on that date when the excel file is opened. Say date is in Excel for 7/5/2018. Today's date is 7/2 - will the email send when I open the spreadsheet 7/5?
Question 2: Several people will use the excel spreadsheet. How best would it be for their signature to be added to the email along with title and phone contact and formatted for Outlook?
Question 3. Is there a better way to send email notifications with Excel on a specific date?
Sub email()
Dim r As Range
Dim cell As Range
Set r = Range("A1:S20")
For Each cell In r
If cell.Value = Date Then
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 = Cells(cell.Row, "C").Value
Email_Send_From = "xxx@xx.com
Email_Send_To = "xxx@xx.com
Email_Cc = ""
Email_Bcc = ""
Email_Body = "Hi " & Cells(cell.Row, "c").Value _
& vbNewLine & vbNewLine & _
Cells(cell.Row, "D").Value & _
" has been submited"
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
End With
End If
Next
Exit Sub
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub
Question 1: If the date is a future date will the email send on that date when the excel file is opened. Say date is in Excel for 7/5/2018. Today's date is 7/2 - will the email send when I open the spreadsheet 7/5?
Question 2: Several people will use the excel spreadsheet. How best would it be for their signature to be added to the email along with title and phone contact and formatted for Outlook?
Question 3. Is there a better way to send email notifications with Excel on a specific date?
Sub email()
Dim r As Range
Dim cell As Range
Set r = Range("A1:S20")
For Each cell In r
If cell.Value = Date Then
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 = Cells(cell.Row, "C").Value
Email_Send_From = "xxx@xx.com
Email_Send_To = "xxx@xx.com
Email_Cc = ""
Email_Bcc = ""
Email_Body = "Hi " & Cells(cell.Row, "c").Value _
& vbNewLine & vbNewLine & _
Cells(cell.Row, "D").Value & _
" has been submited"
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
End With
End If
Next
Exit Sub
debugs:
If Err.Description <> "" Then MsgBox Err.Description
End Sub
Last edited: