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).

Posted in Uncategorized

8 thoughts on “Creating Outlook Appointments in a Non-default Folder

  1. 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……………

  2. I get a runtime error on executing this (although works fine creating appointments to my own personal calendar folder which I have aready tested).

    I am trying to create appointments to a calendar called Invoice Calendar which I created, but is listed as a public folder on our exchange server.

    Can you offer any help?

  3. This is great code and I am using iut quite effectively. What I’d like to know is how you go about using the date captured in a text box on auser form as the date you need to set the appointment for in Outlook?


Posting code? Use <pre> tags for VBA and <code> tags for inline.

Leave a Reply

Your email address will not be published.