Creating Single Appointments

A single (nonrecurring) appointment can be created using either the SingleAppointments table or the Appointments table, which contains the merged contents of the single and recurring tables. Because these tables are linked together, creating an item in one table automatically creates that item in the other table. For more information on the Appointments table, see Merged Tables.

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

The following sample code creates a SingleAppointment object and sets several properties:

Sub CreateAppt()
    Dim objTable As Object, objItem As Object
    Dim dt As Date
    
    'Get the SingleAppointments table from the global Schedule object.
    Set objTable = gobjSched.SingleAppointments
    
    dt = DateAdd("d", 1, Now)
    
    'Create a new item in the SingleAppointments table.
    Set objItem = objTable.New
    
    'Set the desired properties on the item.
    objItem.SetProperties Text:="OLE: CreateAppt " & Now(), _
        Notes:="Notes", _
        Start:=DateAdd("h", 1, dt), _
        End:=DateAdd("h", 2, dt)
    
    'Release the objects.
    Set objItem = Nothing
    Set objTable = Nothing

End Sub