Excel Pulling Outlook Calendar Info

ksg18

New Member
Joined
Dec 12, 2013
Messages
6
Hi, I have looked online to try and get this figured out, but I tend to just get more confused. I have found a code to pull outlook calendar information from outlook to excel. I am trying to determine how to pull from Shared Calendars. This code looks as if they calendar has a number (9), but I can't figure out what the other calendar's numbers would be. I need to figure out how to pull from Shared Calendars and how to pull the month for which the calendar is on. My shared calendars are under Calendars>Shared Calendars in outlook. So for example, I would need to pull John Doe's calendar information for January if the calendar was on January. My code is listed below. Any help would be greatly appreciated!!!!
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:D1").Value = Array("Subject", "Start", "End", "Location")

NextRow = 2

For Each olApt In olFolder.Items
Cells(NextRow, "A").Value = olApt.Subject
Cells(NextRow, "B").Value = olApt.Start
Cells(NextRow, "C").Value = olApt.End
Cells(NextRow, "D").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

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes
Thanks, but how would I manipulate that into what I have? I also tried running the script it showed, but I kept getting a user-type not defined error.
 
Upvote 0

Forum statistics

Threads
1,215,307
Messages
6,124,168
Members
449,146
Latest member
el_gazar

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