Create Appointment using VBA and Custom Form

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

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

David LeeCommented:
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.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PeterRHawkesAuthor Commented:
Thank you!
David LeeCommented:
You're welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.