Importing Outlook Calendar into Excel- adding in recurrences (meeting series)

corri321

New Member
Joined
Aug 22, 2019
Messages
1
Hi there,

I am using this macro to import my outlook Calendar into excel but it is ignoring recurrent meetings and only shows the first instance.
Is there a way I can add this into the code? All my attempts have failed so far.

Code:
 Sub Listappointments()
        Dim olApp As Object
        Dim olNS As Object
        Dim olFolder As Object
        Dim olapt As Object
        Dim NextRow As Long
        Dim FromDate As Date
        Dim ToDate As Date
    
        FromDate = Range("H1")
        ToDate = Range("I1")
       
    
        On Error Resume Next
        Set olApp = GetObject(, "Outlook.Application")
        
         
         
        If Err.Number > 0 Then Set olApp = CreateObject("Outlook.application")
         
        On Error GoTo 0
    
        Set olNS = olApp.GetNamespace("MAPI")
        Set olFolder = olNS.GetDefaultFolder(9) 'olFolderCalendar
         
        NextRow = 2
        
       
    
With Sheets("Sheet1")  'Change the name of the sheet here
            .Range("A1:D1").Value = Array("Project", "Date", "Time spent", "Location")
            For Each olapt In olFolder.Items
                If (olapt.Start >= FromDate And olapt.Start <= ToDate) Then
                    .Cells(NextRow, "A").Value = olapt.Subject
                    .Cells(NextRow, "B").Value = CDate(olapt.Start)
                    .Cells(NextRow, "C").Value = olapt.End - olapt.Start
                    .Cells(NextRow, "C").NumberFormat = "HH:MM"
                    .Cells(NextRow, "D").Value = olapt.Location
                    .Cells(NextRow, "E").Value = olapt.Categories
                    .Cells(NextRow, "F").Value = olapt.Requiredattendees
                    NextRow = NextRow + 1
                
                
                Else
                End If
            Next olapt

        End With
          
    
        Set olapt = Nothing
        Set olFolder = Nothing
        Set olNS = Nothing
        Set olApp = Nothing
    End Sub
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
The following code handles recurring appointments:

 
Upvote 0
Thank you so much John_w!!

Is it possible to do it in the same workbook?
 
Upvote 0
Yes, just replace:
VBA Code:
        Set MyBook = Excel.Workbooks.Add
with:
VBA Code:
        Set MyBook = ThisWorkbook
 
Upvote 0

Forum statistics

Threads
1,214,661
Messages
6,120,790
Members
448,994
Latest member
rohitsomani

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