Excel VBA to Extract Shared Outlook Calendar

thasvold

New Member
Joined
Nov 16, 2018
Messages
2
Please forgive me and any help would be greatly appreciated. I am trying to get a VBA to extract a shared calendar from outlook. The below will get my information but I am having trouble finding a way to get another calendar. I've been googling this for a while but most solutions are way over my head.

Option Explicit

Sub ListAppointments()

Dim olApp As Object
Dim olNS As Object
Dim olFolder As Object
Dim olApt As Object
Dim NextRow As Long

Set olApp = CreateObject("Outlook.Application")

Set olNS = olApp.GetNamespace("MAPI")

Set olFolder = olNS.GetDefaultFolder(9) 'olFolderCalendar

Range("A1:e1").Value = Array("Organizer", "Subject", "Start", "End", "Location")

NextRow = 2

For Each olApt In olFolder.Items
Cells(NextRow, "A").Value = olApt.Organizer
Cells(NextRow, "B").Value = olApt.Subject
Cells(NextRow, "C").Value = olApt.Start
Cells(NextRow, "D").Value = olApt.End
Cells(NextRow, "E").Value = olApt.Location
NextRow = NextRow + 1
Next olApt

Set olApt = Nothing
Set olFolder = Nothing
Set olNS = Nothing
Set olApp = Nothing

Columns.AutoFit

End Sub
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.

Forum statistics

Threads
1,223,877
Messages
6,175,138
Members
452,614
Latest member
MRSWIN2709

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