Creating Outlook Appointments in a Non-default Folder

If you’ve read my other page at

http://www.dicks-clicks.com/excel/olCalendar.htm#Creating_an_Appointment

then you know how to create an AppointmentItem in the default calendar folder. To create an AppointmentItem in a folder other than the default calendar folder, you can’t use the CreateItem method. Instead you need the Add method of the Items collection object for that folder.

Here’s an example that creates an appointment in a folder called OtherCal.

Sub ApptToOtherCal()

    Dim olApp As Outlook.Application
    Dim olAppt As Outlook.AppointmentItem
    Dim olFldr As Outlook.MAPIFolder
    
    Set olApp = New Outlook.Application
    Set olFldr = olApp.GetNamespace(”MAPI”).Folders(”Personal Folders”) _
        .Folders(”OtherCal”)
        
    Set olAppt = olFldr.Items.Add
    
    With olAppt
        .Start = Now + TimeSerial(1, 0, 0)
        .End = Now + TimeSerial(2, 0, 0)
        .Subject = “Post to blog”
        .Save
    End With
    
    Set olApp = Nothing
    
End Sub

Of course you’ll need to set a reference to the Outlook Object Library for this code to work (it’s early bound).

5 Comments

  1. Calvin:

    Thanks…it works[had to fix the quotes]
    just what i needed.

  2. George:

    You are a life-saver.
    Thank you very much.
    I was stack to CreateItem method and i didn’t find a method to make .Add to work.

    Set olAppt = olFldr.Items.Add is the solution to my probs.

    Thanks again……………

  3. Leif:

    Thanks. It was very helpful. All tutorials should as concise and accurate as this one.

  4. Katie:

    This was SO helpful!!! Thank you very much!!!!

  5. David Park:

    Exactly the information I needed. Thanks…

Leave a comment