Extracting appointments from shared Outlook calendar to Excel

后端 未结 3 1591
挽巷
挽巷 2021-01-24 06:55

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

3条回答
  •  广开言路
    2021-01-24 07:59

    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
    

提交回复
热议问题