我有一些VBa代码可以在新窗口中打开日历,但我现在需要它来显示我已经设置的共享日历,但我能找到的唯一代码创建一个我刚刚创建的新窗口中的新共享日历;
Sub DispCalendars()
Dim myOlApp As Outlook.Application
Dim myNms As Outlook.NameSpace
Dim myFolder As Outlook.MAPIFolder
Dim myRecipient As Outlook.Recipient
Dim myExplorer As Outlook.Explorer
Dim SharedFolder As Outlook.MAPIFolder
Set myOlApp = CreateObject("Outlook.Application")
Set myNms = myOlApp.GetNamespace("MAPI")
Set myFolder = myNms.GetDefaultFolder(olFolderCalendar)
Set myExplorer = myOlApp.ActiveExplorer
Set myExplorer.CurrentFolder = myFolder
Set myRecipient = myNms.CreateRecipient("Bob the Builder")
Set SharedFolder = myNms.GetSharedDefaultFolder(myRecipient, olFolderCalendar)
myExplorer.SelectFolder SharedFolder
End Sub
如果我改为' myRecipient'只是一个名字,它错误,我似乎无法解决它。
Here是它看起来的样子(当我手动完成时),我想在代码中重新创建它。
答案 0 :(得分:1)
我想你错过了显示在Outlook中选择的文件夹的行
myExplorer.CurrentFolder = SharedFolder
我想而不是“selectfolder”-line ...也可以删除其他一些行,特别是
设置myExplorer.CurrentFolder = myFolder
因为它不会让sende在一个Sub中一个接一个地打开两个文件夹。
此致 最大