Referencing a shared calendar

前端 未结 1 1123
时光说笑
时光说笑 2021-01-27 19:57

I tried to run the code from this question: Exporting Outlook calendar data to Excel file - Shared calendars and VBA

My code modification.

Set olNS = ol         


        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-27 20:22

    Error 13 in VBA means a type mismatch. See Type mismatch (Error 13) for more information.

    You need to use the following code instead:

    Sub ShowSharedFolder(OutlookApplication As Outlook.Application) 
       Dim myNamespace As Outlook.NameSpace 
       Dim myRecipient As Outlook.Recipient 
       Dim CalendarFolder As Outlook.Folder 
    
       Set myNamespace = OutlookApplication.GetNamespace("MAPI") 
       Set myRecipient = myNamespace.CreateRecipient("theOtherUser") 
       myRecipient.Resolve 
    
       If myRecipient.Resolved Then 
         Set CalendarFolder = myNamespace.GetSharedDefaultFolder(myRecipient, olFolderCalendar) 
         CalendarFolder.Display 
       End If 
    End Sub 
    

    0 讨论(0)
提交回复
热议问题