Setting an Email Reminder with VBA

cfoye130

Board Regular
Joined
Aug 12, 2008
Messages
84
I'm trying to set an email reminder to fire at 3pm on a date specified in the ctl_lbl_DueDateValue label on a user form.

I can't seem to get this to work. Anyhelp would be appreciated. Thanks! (Using Outlook and Excel '03)

Code:
Sub SendEmail(EmailContent As String)
    Dim OutlookApp As Object
    Dim EmailContent As String
    Dim duedateval As Date
 
    Const olMailItem = 0
 
    Set OutlookApp = CreateObject("Outlook.Application")
 
    With OutlookApp.CreateItem(olMailItem)
        .To = ""
        .Subject = "Operational Risk - Key Risk Metric Data Entry Due"
        .Body = EmailContent
        .attachments.Add ThisWorkbook.FullName
        .importance = 2
        .ReminderSet = True
        .ReminderTime = "15:00"
        duedateval = form_UI.ctl_lbl_Duedatevalue
        .duedate = Now
        .Display
    End With
End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
It looks like you are mixing Email properties (.To) with Task properties (.DueDate)

This creates a task in Outlook.

Code:
Sub SendEmail(EmailContent As String)

    Dim OutlookApp As Object
 
    Set OutlookApp = CreateObject("Outlook.Application")

    With OutlookApp.CreateItem([COLOR="Red"]olTaskItem[/COLOR])
        .Subject = "Operational Risk - Key Risk Metric Data Entry Due"
        .Body = EmailContent
        .attachments.Add ThisWorkbook.FullName
        .importance = 2
        .ReminderSet = True
        .ReminderTime = "15:00"
        .DueDate = DateValue(form_UI.ctl_lbl_Duedatevalue)
        .Display
    End With
    
End Sub
 
Upvote 0
Ah, well that does help.

What then would be the properties I would use to set a due date flag for an email?
 
Upvote 0
I haven't tried this....

Code:
Sub SendEmail(EmailContent As String)

    Dim OutlookApp As Object
 
    Set OutlookApp = CreateObject("Outlook.Application")

    With OutlookApp.CreateItem([COLOR="Red"]olMailItem[/COLOR])
        .To = "JohnDoe@Blah.com"
        .Subject = "Operational Risk - Key Risk Metric Data Entry Due"
        .Body = EmailContent
        .attachments.Add ThisWorkbook.FullName
        [COLOR="Red"].DeferredDeliveryTime = DateValue(form_UI.ctl_lbl_Duedatevalue)[/COLOR]
        .Send
    End With
    
End Sub
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,030
Messages
6,128,408
Members
449,448
Latest member
Andrew Slatter

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top