Code to create a (self-imposed) task w/reminder 
Author Message
 Code to create a (self-imposed) task w/reminder

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



Sat, 05 Nov 2005 12:49:17 GMT  
 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



Sat, 05 Nov 2005 22:01:34 GMT  
 Code to create a (self-imposed) task w/reminder
Thanks, Ken.  Works perfectly now.  The way I had it, there was no
way to use the .ReminderTime property.

MT


Quote:

> 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



> > 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



Sat, 05 Nov 2005 22:31:03 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Creating Tasks/Reminders from Access

2. create task item for self

3. Setting Reminders for Assigned Tasks

4. Task's due date and reminder date

5. Setting reminders in assigned tasks

6. Outlook 2000 Setting Reminder Time before Task is Assigned

7. Tasks and Reminders

8. Adding a Reminder time to a task

9. To-do list (task list) and reminder

10. Self Modifing Code VB Code

11. Code to create Calendar entries from Tasks?

12. Task Scheduler API self delete job

 

 
Powered by phpBB® Forum Software