Sdílet prostřednictvím


Interval Property

Returns or sets a Long specifying the number of units of a given recurrence type between occurrences. For example, setting the Interval property to 2 and the RecurrenceType property to Weekly would cause the pattern to occur every second week. Read/write.

Note  The Interval property must be set before setting PatternEndDate. Also, the Interval property is not valid for yearly recurrence patterns.

expression**.Interval**

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

Example

This Visual Basic for Applications (VBA) example uses GetRecurrencePattern to obtain the RecurrencePattern object for the newly created AppointmentItem. When 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 myOlApp As Outlook.Application
    Dim myApptItem As Outlook.AppointmentItem
    Dim myRecurrPatt As Outlook.RecurrencePattern
    Set myOlApp = New Outlook.Application
    Set myApptItem = myOlApp.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

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 myApptItem = Application.CreateItem(1)
Set myRecurrPatt = myApptItem.GetRecurrencePattern
myRecurrPatt.RecurrenceType = 1
myRecurrPatt.DayOfWeekMask = 2
myRecurrPatt.PatternStartDate = #1/21/03 2:00:00 PM#
myRecurrPatt.Interval = 3
myRecurrPatt.PatternEndDate = #12/21/04 5:00:00 PM#
myApptItem.Subject = "Important Appointment"
myApptItem.Save
myApptItem.Display
Set myApptItem = Nothing
Set myRecurrPatt = Nothing

Applies to | RecurrencePattern Object

See Also | EndTime Property | Exception Object | Exceptions Object | Exceptions Property | Occurrences Property | PatternEndDate Property | PatternStartDate Property | RecurrenceState Property | StartTime Property