Compartir a través de


RecurrencePattern.Interval Property (Outlook)

Returns or sets a Long specifying the number of units of a given recurrence type between occurrences. Read/write.

Syntax

expression .Interval

expression A variable that represents a RecurrencePattern object.

Remarks

The Interval property must be set before setting PatternEndDate.

For example, setting the Interval property to 2 and the RecurrenceType property to olRecursWeekly would cause the pattern to occur every second week.

When RecurrenceType is set to olRecursYearNth or olRecursYear, the Interval property indicates the number of years between occurrences. For example, Interval equals 1 indicates the recurrence is every year, Interval equals 2 indicates the recurrence is every 2 years, and so on.

Example

This Visual Basic for Applications example uses GetRecurrencePattern to obtain the RecurrencePattern object for the newly-created AppointmentItem. The properties, RecurrenceType , DayOfWeekMask , PatternStartDate , Interval , PatternEndDate , and Subject are set, the appointment is saved and then displayed with the pattern: "Occurs every 3 week(s) on Monday effective 1/21/2003 until 12/21/2004 from 2:00 PM to 5:00 PM."

Sub CreateAppointment() 
 
 Dim myApptItem As AppointmentItem 
 
 Dim myRecurrPatt As RecurrencePattern 
 
 
 
 
 
 Set myApptItem = Application.CreateItem(olAppointmentItem) 
 
 Set myRecurrPatt = myApptItem.GetRecurrencePattern 
 
 myRecurrPatt.RecurrenceType = olRecursWeekly 
 
 myRecurrPatt.DayOfWeekMask = olMonday 
 
 myRecurrPatt.PatternStartDate = #1/21/2003 2:00:00 PM# 
 
 myRecurrPatt.Interval = 3 
 
 myRecurrPatt.PatternEndDate = #12/21/2004 5:00:00 PM# 
 
 myApptItem.Subject = "Important Appointment" 
 
 myApptItem.Save 
 
 myApptItem.Display 
 
 Set myOlApp = Nothing 
 
 Set myApptItem = Nothing 
 
 Set myRecurrPatt = Nothing 
 
End Sub

See Also

Concepts

How to: Create an Appointment as a Meeting on the Calendar

RecurrencePattern Object

RecurrencePattern Object Members