Creating an Outlook Task with VB Script

  • Thread starter Thread starter Pegasus \(MVP\)
  • Start date Start date
P

Pegasus \(MVP\)

The following code fragment comes from here:
http://www.microsoft.com/technet/scriptcenter/resources/officetips/sept05/tips0908.mspx
Const olTaskItem = 3

Set objOutlook = CreateObject("Outlook.Application")
Set objTask = objOutlook.CreateItem(olTaskItem)

objTask.Subject = "Script Center Master Plan"
objTask.Body = "Final report for Script Center master plan."
objTask.ReminderSet = True
objTask.ReminderTime = #12/12/2007 09:00 AM#
objTask.DueDate = #12/12/2007 10:00 PM#

objTask.Save

It successfully creates an Outlook Task Item. Unfortunately it
appears to have major flaw: The Due Time and the ReminderTime
can be set for appointments that are in the past or on the current
day but not for those that are in the future. For future dates it gets
set to the Outlook "Working Day" default (e.g. to 08:00).

Does anyone know how to get around this problem? Or how
to create a "Reminder" instead of a "Task".

I'm using Outlook 2003
 
Try setting the DueDate before the ReminderTime.

Note that DueDate ignores any time element and stores 12 a.m. instead.
 
Bingo! This one cost me a few hours of debugging time.
Now let's see if I can get Microsoft to adjust their web
page accordingly. . .

Thanks for your help. By the way, do have some link for
creating a Reminder instead of a Task?


Try setting the DueDate before the ReminderTime.

Note that DueDate ignores any time element and stores 12 a.m. instead.
 
There is no independent Reminder object. Messages, tasks, contacts, and appointments can all have reminders associated with them.
 
Back
Top