Hi Experts!
I am new to VBA and currently I am exploring using VBA to help with sending reminder by just clicking one button. I have finished creating the coding for sending email via outlook but now I couldn't fix certain issue as follow:
- To send reminder email for certain date. Example if the due date is today, the program can auto detect/lookup the due date with today date in that column and send out the reminder email without sending email for other dates.
- To a command button which by clicking it, it will prompt the system to send email.
Below is the excel listing and VBA code
Column 1 is Name
Column 2 is Prof
Column 3 is Email
Column 4 is Due Date
-----------------------------------------------------------
Sub SendMail()
Dim OlApp As Outlook.Application
Dim OlMail As Outlook.MailItem
For i = 2 To 4
Set OlApp = New Outlook.Application
Set OlMail = OlApp.CreateItem(olMailItem)
With OlMail
.To = Cells(i, 3).Value
.Subject = "Oral report Submission for " & Cells(i, 1).Value
.Body = "Dear " & Cells(i, 2).Value & "," & vbNewLine & vbNewLine & "This is a gentle reminder that student " & Cells(i, 1).Value & " oral report is going to due on " & Cells(i, 4).Value
.Display
End With
Set OlMail = Nothing
Set OlApp = Nothing
Next
End Sub
Your Help is greatly appreciated!
Bookmarks