Create Appointment using VBA and Custom Form

Posted on 2008-11-05
Medium Priority
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
  • 2
LVL 76

Accepted Solution

David Lee earned 2000 total points
ID: 22891629
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

ID: 31513647
Thank you!
LVL 76

Expert Comment

by:David Lee
ID: 22893703
You're welcome.

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
For a while now I'v been searching for a circular progress control, much like the one you get when first starting your Silverlight application. I found a couple that were written in WPF and there were a few written in Silverlight, but all appeared o…
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. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .

807 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