Outlook Calendar Appointment Creation Using VBA

Titan2

New Member
Joined
Jan 23, 2025
Messages
2
Office Version
  1. 365
Platform
  1. Windows
I am trying to using VBA to create calendar appointments using data found in specific cells of a workbook.
The code works and it has no issues creating the appointments.

The problem is: It only creates appointments in my own personal calendar. (The first calendar everyone has.)

I want the ability to create appointments in my own sub calendars or in a shared folder.
Attached picture: The Green boxes are where I would like the appointments to go. The Red box is where the code currently puts everything.

I've been trying to use code from another thread to troubleshoot doing that but I haven't been successful.
The other thread: Creating an Outlook Appointment in a shared calendar
@John_w has done a lot of great work in that thread helping/explaining.

The code I'm using to try and learn about the "Tour" calendar folder.

VBA Code:
Sub CalendarChecker()

Dim olApp As Outlook.Application
Dim outNameSpace As Namespace
Dim outSharedName As Outlook.Recipient
Dim outCalendarFolder As MAPIFolder
Dim olAppItem As Outlook.AppointmentItem

    Set olApp = CreateObject("Outlook.Application")
    Set outNameSpace = olApp.GetNamespace("MAPI")
    Set outCalendarFolder = outNameSpace.Folders(John.Smith@micro.gov)
    Set outCalendarFolder = outCalendarFolder.Folders("Calendar")

    Debug.Print outCalendarFolder.Name
    Debug.Print outCalendarFolder.FolderPath

End Sub


The output:

Calendar
\\JOHN.SMITH@micro.gov

The above code works but anytime I try and substitute or add "Tour" into anything, it breaks.
I also can't figure out how to point it at a Shared Calendar.

Any assistance would be greatly appreciated.
 

Attachments

  • Calendars.png
    Calendars.png
    58.3 KB · Views: 1

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop

Forum statistics

Threads
1,225,974
Messages
6,188,167
Members
453,462
Latest member
no LeeMac

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top