引用共享日历 [英] Referencing a shared calendar

查看:102
本文介绍了引用共享日历的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图从以下问题运行代码: 将Outlook日历数据导出到Excel文件-共享日历和VBA

I tried to run the code from this question: 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类型不匹配的错误.我已经测试了不同的组合,但没有结果.

I got error 13 Type mismatch. I've testing different combinations without result.

我也测试了这个例子: MSDN链接

I tested this example too: MSDN link

此信息有用但还不够: http://www.snb-vba .eu/

This info is useful but not enough: http://www.snb-vba.eu/

我需要将共享的MS Outlook的日历(与Exchange服务器一起)导出到MS Excel.

I need to export shared MS Outlook's calendars (with Exchange server) to MS Excel.

这些日历共享给我和其他人.

These calendars are shared to me and other people.

我运行MS Office 2010版本.

I run MS Office 2010 version.

推荐答案

VBA中的错误13表示类型不匹配.请参见类型不匹配(错误13)有关更多信息.

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

您需要改用以下代码:

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 

这篇关于引用共享日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆