
Code to create a (self-imposed) task w/reminder
I get a reminder firing when running your code but the reminder is
rather overdue, having been set for the year 1899 <g>
.ReminderTime = DateAdd("h", 6, Now) adds 6 hours to the current
date/time and produces a reminder that is set to fire 6 hours from
now.
If you want the reminder to fire on today's date but at 8:00 PM, the
following snippet would do that:
Sub CreateDropoffReminder()
Dim OL As Outlook.Application
Dim ta As Outlook.TaskItem
Dim s As String
Set OL = CreateObject("Outlook.Application")
Set ta = OL.CreateItem(olTaskItem)
s = CStr(Date)
s = s & " " & "8:00 PM"
With ta
.Subject = "Overnight drop-off by 9pm!"
.DueDate = Now
.StartDate = Now
.ReminderOverrideDefault = True
.ReminderSet = True
.ReminderTime = CDate(s)
.Save
End With
End Sub
--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Lead Author, Professional Outlook 2000 Programming, Wrox Press
Lead Author, Beginning VB 6 Application Development, Wrox Press
Attachment Options
http://www.slovaktech.com/attachmentoptions.htm
Extended Reminders
http://www.slovaktech.com/extendedreminders.htm
Quote:
> Outlook newbie, VBA experience w/other programs. Outlook 2000 SR-1.
> I must be missing something very simple but it escapes me. I want
> to set up a task with a pop-up reminder. Using the code below, I
> get the task but no reminder set. Looking in the object browser I
> don't see any other property or method of the TaskItem object that
> (intuitively) seems to be missing. Help?
> Sub CreateDropoffReminder()
> Dim OL As Application, ta As TaskItem
> Set OL = CreateObject("Outlook.Application")
> Set ta = OL.CreateItem(olTaskItem)
> With ta
> .Subject = "Overnight drop-off by 9pm!"
> .DueDate = Now
> .StartDate = Now
> .ReminderOverrideDefault = True
> .ReminderSet = True
> .ReminderTime = #8:30:00 PM#
> .Save
> End With
> End Sub
> "Life is nothing if you're not obsessed." --John Waters