Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Calendar automation (2007)

    I have been using an automation script to enter appointments into outlook. It works well in adding the appointments to the standard calendar in outlook.
    I am trying to use exchange server with several calendars. Is there a way that I can direct the output(the scheduled appointment) to an exchange calendar or a custom outlook calendar.

    I've been using the following snippet of the code;

    Private Sub cmdAddAppt_Click()
    'On Error GoTo Add_Err

    'Save record first to be sure required fields are filled.
    DoCmd.RunCommand acCmdSaveRecord

    'Exit the procedure if appointment has been added to Outlook.
    If Me!AddedToOutlook = True Then
    MsgBox "This appointment is already added to Microsoft Outlook"
    Exit Sub
    'Add a new appointment.
    Else
    Dim objOutlook As Outlook.Application
    Dim objAppt As Outlook.AppointmentItem

    Set objOutlook = CreateObject("Outlook.Application")
    Set objAppt = objOutlook.CreateItem(olAppointmentItem)

    With objAppt
    .Start = Me!ApptDate & " " & Me!ApptTime
    .Duration = Me!ApptLength
    .Subject = Me!First & " " & Me.Lastname



    If Not IsNull(Me!ApptLocation) Then .Location = Me!ApptLocation & " ID# " & Me.PatientID & " " & Me.Weight & " Notes:" & Me.ApptNotes
    If Me!ApptReminder Then
    .ReminderMinutesBeforeStart = Me!ReminderMinutes
    .ReminderSet = True
    End If

    Is there a way?

    nebbia

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Calendar automation (2007)

    Instead of

    Set objAppt = objOutlook.CreateItem(olAppointmentItem)

    which will create an appointment in he default calendar, use Items.Add for the folder in which you want to create the item:

    Dim myFolder As Outlook.MAPIFolder
    Set myFolder = ... ' reference to the target folder
    Set myItem = myFolder.Items.Add(olAppointmentItem)

  3. #3
    2 Star Lounger
    Join Date
    May 2005
    Posts
    180
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Calendar automation (2007)

    Thanks. Though I won't be able to try it now I will as soon as I get a chance.

    Thanks for the help

    nebbia

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •