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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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