Creating Recurring Tasks

Schedule+ allows you to define recurring tasks. The exact task dates are determined by a recurrence pattern that specifies on which days, weeks, months, or years the task recurs.

    To create a recurring task
  1. Get the RecurringTasks table from the global Schedule object.
  2. Use the New method to create a new item in the RecurringTasks table.
  3. Set the desired properties on the item.
  4. Release the objects.

The following sample code creates a task that recurs weekly on Tuesday and sets a reminder two days before the task:

Public Sub CreateRecurTask()
    Dim objTable As Object
    Dim objItem As Object
    Dim dt As Date
    
    'Get the RecurringTasks table from the global Schedule object.
    Set objTable = objSchedule.RecurringTasks
    
    'Create a new item in the RecurringTasks table.
    Set objItem = objTable.New
    
    'Set the desired properties on the item.
    dt = Now
    objItem.SetProperties Text:="Weekly Recurring Task" & Now(), _
        Ring:=True, AlarmAmount:=2, _
        AlarmTypeUnit:=typeunitDay, BeforeEnd:=False, _
        RecurringType:=trecurWeekly, WeekInterval:=1, _
        DayOfWeekMask:=4, DayOfWeekStart:=0, _
        StartRecurringDate:=LConvertTo32bitDate(dt), _
        EndRecurringDate:=LConvertTo32bitDate(DateAdd("yyyy", 1, dt)), _
        StartRecurringTime:=LConvertTo32bitTime(DateAdd("h", 1, dt)), _
        EndRecurringTime:=LConvertTo32bitTime(DateAdd("h", 2, dt))

    'Release the objects.
    Set objItem = Nothing
    Set objTable = Nothing
End Sub