我试图从这个问题运行代码: Exporting Outlook calendar data to Excel file - Shared calendars and VBA
我的代码修改。
Set olNS = olApp.GetNamespace("MAPI")
Set myCalItems = olNS.CreateRecipient("theOtherUser")
myCalItems.Resolve
myCalItems.GetSharedDefaultFolder
我收到错误13类型不匹配。我测试了不同的组合而没有结果。
我也测试了这个例子: MSDN link
此信息很有用,但还不够:http://www.snb-vba.eu/
我需要将共享MS Outlook的日历(使用Exchange服务器)导出到MS Excel。
这些日历与我和其他人分享。
我运行MS Office 2010版本。
答案 0 :(得分:0)
VBA中的错误13表示类型不匹配。有关详细信息,请参阅Type mismatch (Error 13)。
您需要使用以下代码:
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