Outlook 2010选择日历 [英] Outlook 2010 Select Calendar

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

问题描述

我有一些用户希望在他们的Outlook中切换到日历文件夹时选择多个日历。
所以我拿了一个示例代码:

I have some users who would like to have multiple calendars selected when they switch to calendar folder in theirs Outlook. So I took a sample code from:

http://www.slipstick.com/developer/code-samples/select-multiple-calendars-outlook/

修改它一点,并给我的用户。问题是,它不工作在这些Outlook之一,我找不到为什么。
下面是我的代码,确切的问题是,这个宏不能选择/启用我想要的日历 - 但如果我尝试调试代码,并把MsgBox测试 - 看起来像代码是在正确的地方。 Procmon没有显示任何访问被拒绝或其他类型的错误。
你能帮我调查一下吗?

Modified it a little and gave to my users. Problem is that it is not working on one of these Outlooks and I cannot find out why. Below is my code and the exact problem is that this macro cannot "select/enable" the calendar I want - but if I try to debug the code and put MsgBox for testing - looks like the code is in right place. Procmon is not showing any "access denied" or other kind of errors. Could You help me to investigate this ?

    Sub SelectCalendars()
    Dim objPane As Outlook.NavigationPane
    Dim objModule As Outlook.CalendarModule
    Dim objGroupA, objGroupB As Outlook.NavigationGroup
    Dim objNavFolder As Outlook.NavigationFolder
    Dim objCalendar As Folder
    Dim objFolder As Folder
    Dim i As Integer
    Dim test As Outlook.NavigationFolder


    Set Application.ActiveExplorer.CurrentFolder = Session.GetDefaultFolder(olFolderCalendar)
    DoEvents

    Set objCalendar = Session.GetDefaultFolder(olFolderCalendar)
    Set objPane = Application.ActiveExplorer.NavigationPane
    Set objModule = objPane.Modules.GetNavigationModule(olModuleCalendar)


    With objModule.NavigationGroups
        Set objGroupA = .Item(1)
    End With

    ' First calendar group
    Set objNavFolder = objGroupA.NavigationFolders.Item(1)
    MsgBox objNavFolder.DisplayName
    MsgBox objNavFolder.IsSelected
    objNavFolder.IsSelected = False

   ' Second calendar group
    Set objNavFolder = objGroupA.NavigationFolders.Item(2)
    MsgBox objNavFolder.DisplayName
    MsgBox objNavFolder.IsSelected
    objNavFolder.IsSelected = False


    Set objPane = Nothing
    Set objModule = Nothing
    Set objGroup = Nothing
    Set objNavFolder = Nothing
    Set objCalendar = Nothing
    Set objFolder = Nothing
End Sub


推荐答案

首先,我建议使用 Debug.Print 语句而不是消息框。

First of all, I'd suggest using the Debug.Print statements instead of Message boxes.

IsSelected NavigationFolder类的属性允许设置一个布尔变量,指示是否选择了NavigationFolder对象进行显示。尝试将此属性设置为true(而不是false)。

The IsSelected property of the NavigationFolder class allows to set a boolean variable that indicates whether the NavigationFolder object is selected for display. Try to set this property to true (instead of false).

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

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