Partager via


Regenerate Property

True if the task should be regenerated following this pass through the recurrence pattern. This property is used to control the regeneration of the task as each occurrence of a recurring task is completed. Read/write Boolean.

expression**.Regenerate**

*expression    * Required. An expression that returns a RecurrencePattern object.

Example

This Visual Basic for Applications (VBA) example creates a task called "Oil Change" that recurs every three months and uses the Regenerate property to set it to regenerate after each recurrence.

Sub CreateTaskOilChange()
    Dim myOlApp As Outlook.Application
    Dim myItem As Outlook.TaskItem
    Dim myPattern As Outlook.RecurrencePattern
    Set myOlApp = CreateObject("Outlook.Application")
    Set myItem = myOlApp.CreateItem(olTaskItem)
    Set myPattern = myItem.GetRecurrencePattern
    myPattern.RecurrenceType = olRecursMonthly
    myPattern.Regenerate = True
    myPattern.Interval = 3
    myItem.Subject = "Oil Change"
    myItem.Save
    myItem.Display
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to perform the same task using VBScript code.

Set myItem = Application.CreateItem(3)
Set myPattern = myItem.GetRecurrencePattern
myPattern.RecurrenceType = 2
myPattern.Regenerate = True
myPattern.Interval = 3
myItem.Subject = "Oil Change"
myItem.Save
myItem.Display

Applies to | RecurrencePattern Object