Create Appointment using VBA and Custom Form

Posted on 2008-11-05
Last Modified: 2013-11-25
I have created a Custom Appointment Form called 'PRH Appointment' and published to Personal Forms Library.
I now wish to create new appointments via VBA utilizing this Form .... how is causing me some difficulty!
Can someone assist me in how to amend my code snippet, which simply uses the default form, to allow me to achieve my goal?

Dim olApp As Outlook.Application

            Dim olApt As AppointmentItem            


            Set olApp = New Outlook.Application

            Set olApt = olApp.CreateItem(olAppointmentItem)


            With olApt

                .Start = dteStart

                .End = dteEnd

                .Subject = strEvent

                .Location = strLocation

                .Body = strbody

                .BusyStatus = olFree

                .ReminderSet = False

                .Categories = strCat


            End With


            Set olApt = Nothing

            Set olApp = Nothing

Open in new window

Question by:PeterRHawkes
    LVL 76

    Accepted Solution

    Hi, PeterRHawkes.

    You need to change line #5.  It is going to create a default appointment item, not your custom appointment.  Use this command sequence to create an item using your custom form

        Set olkFolder = Session.GetDefaultFolder(olFolderCalendar)
        Set olApt = olkFolder.Items.Add("IPM.Appointment.MyAppointmentFormName")

    Replace "MyAppointmentFormName" with the name of your form.

    Author Closing Comment

    Thank you!
    LVL 76

    Expert Comment

    by:David Lee
    You're welcome.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    This tutorial is about how to put some of your C++ program's functionality into a standard DLL, and how to make working with the EXE and the DLL simple and seamless.   We'll be using Microsoft Visual Studio 2008 and we will cut out the noise; that i…
    zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA.…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now