Outlook 2013 VBA显示共享日历 [英] Outlook 2013 VBA display Shared Calendar
问题描述
我有一些VBa代码可以在新窗口中打开日历,但是现在我需要它来显示已经设置的共享日历,但是我能找到的唯一代码是在其中创建新的共享日历我刚刚创建的新窗口;
I've got some VBa code that opens the Calendar in a new window, but I now need it to display the shared calendars that I've already got setup, but the only code I can find Creates a new shared calendar in the new window i've just created;
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"部分更改为一个名称,则会出错,并且似乎无法解决问题.
If I change to 'myRecipient' part to just a name, it errors and I can't seem to work it out.
此处是它的外观(当我手动操作时),我会喜欢用代码重新创建.
Here is something how it looks (when I do it manually) and I would like to recreate it in code.
推荐答案
我认为您错过了显示Outlook中所选文件夹的行
I think you miss the line to show the Folder selected in Outlook
myExplorer.CurrentFolder = SharedFolder
我猜想不是"selectfolder"行,也可以删除其他一些行,特别是
i guess instead of the "selectfolder"-line... also some of the other lines could be deleted, espacially
设置myExplorer.CurrentFolder = myFolder
Set myExplorer.CurrentFolder = myFolder
因为它不能使发送者在一个Sub中一个接一个地打开两个文件夹.
as it does not make sende to open two Folders one after another in one Sub.
您的 最高
这篇关于Outlook 2013 VBA显示共享日历的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!