I am trying to extract appointments from a shared Outlook calendar to Excel using a VBA macro in Excel. The code fails whether I try to define objOwner and
here's the code @Ryan Wildry wrote for you with a start and end date input, in case you want to export it for a specified period of time. You need to add the following lines:
Dim FromDate As Date
Dim ToDate As Date
FromDate = InputBox("Enter the start date (format: yyyy/mm/dd)")
ToDate = InputBox("Enter the end date(format: yyyy/mm/dd)")
For Each olApt In olFolder.Items
If (olApt.Start >= FromDate And olApt.Start <= ToDate) Then
myArr(0, NextRow) = olApt.Subject
myArr(1, NextRow) = olApt.Start
myArr(2, NextRow) = olApt.End
myArr(3, NextRow) = olApt.Categories
NextRow = NextRow + 1
Else
End If
Next
On Error GoTo 0