关闭 Outlook 提醒 [英] Dismiss Outlook reminder

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

问题描述

我无法在 Outlook 警报显示之前以编程方式关闭它.

I am having no luck dismissing an Outlook alert programmatically before it displays.

Private Sub Application_Reminder(ByVal Item As Object)
    Dim objRem As Reminder
    Dim objRems As Reminders
    If Item.Subject = "TESTING" Then
        'downloadAndSendSpreadReport
        Set objRems = Application.Reminders
        i = 0
        For Each objRem In objRems
            i = i + 1
            If objRem.Caption = "TESTING" Then
                objRems.Remove i
                If objRem.IsVisible Then
                    objRem.Dismiss
                End If
                Exit For
            End If
        Next objRem
        Item.ReminderSet = False
        Item.Delete
        'Item.Dismiss
    End If
End Sub

我想将此约会项用作某些宏的触发器,而无需用户手动关闭提醒.

I want to use this appointment Item as a trigger to some macro without needing users to manually dismiss the reminder.

在我看来,当触发此事件时,提醒项不可见,因此无法解除

Seems to me, when this event is triggered, the reminder item is NOT visible, thus cannot be dismissed

我试图从提醒集中删除它,但这似乎从我的日历中删除了整个事件.此外,它仍会显示非 ASCII 格式的 STRANGE TITLE 提醒.

I tried to remove it from the reminders set but this seems to delete the whole event from my calendar. Also, it will still display a STRANGE TITLE reminder not in ASCII.

我尝试将约会项的remoteSet属性设置为false,仍然弹出提醒属性.

I tried to set the reminderSet property of the appointment item to false, the reminder property still pops up.

所以我正在寻找一种方法来 a) 在提醒自动弹出之前关闭它/b).在它自动弹出后关闭提醒......或在 Outlook 中执行预定 MACRO 的任何解决方法.(请注意,我无权在 Windows 或 VBS 中使用计划作业.)

So I am looking for a way to a) dismiss the reminder before it pops automatically/ b). dismiss the reminder after it pops automatically....or any workaround to do a scheduled MACRO in Outlook. (Please note that I do not have permission to use scheduled job in Windows nor VBS.)

更新:

现在我有以下代码.提醒正在被删除,但它仍然会弹出一个提醒窗口,标题为没有约会/提醒"之类的.

Now I have the following code. The reminder is being removed, but it will still pop out a reminder window with a caption like "There is no appointment/reminder" something like this.

beforeReminderShow 事件在提醒对象 isVisible = true 的意义上很有用

The beforeReminderShow event is useful in the sense the Reminder Object isVisible = true

所以我可以关闭..但是即使有 0 个事件,提醒窗口也会继续弹出.

so I can dismiss out.. but the reminders windows will continue to pop up even if there's 0 event.

Private WithEvents olRemind As Outlook.Reminders
Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)
Set objRems = Application.Reminders
    For Each objRem In objRems
        If objRem.Caption = "TESTING" Then
            If objRem.IsVisible Then
                objRem.Dismiss
            End If
            Exit For
        End If
    Next objRem

End Sub

[已解决] - 最终编辑
最终的解决方案可行(我放在ThisOutlookSession"模块中).希望这对其他人有帮助.

[Solved] - final edit
The final solution workable (I placed in "ThisOutlookSession" Module). Hope this helps others.

' declare this object withEvents displaying all the events
Private WithEvents olRemind As Outlook.Reminders
Private Sub Application_Reminder(ByVal Item As Object)
    Set olRemind = Outlook.Reminders
    ' RUN OTHER MACRO HERE
End Sub

Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)

    For Each objRem In olRemind
        If objRem.Caption = "TESTING" Then
            If objRem.IsVisible Then
                objRem.Dismiss
                Cancel = True
            End If
            Exit For
        End If
    Next objRem

End Sub

推荐答案

我知道的唯一方法如下.

The only way I know how to do this is as follows.

你需要在你的模块/类的顶部:

You need this at the top of your module/class:

Private WithEvents olRemind As Outlook.Reminders

然后,当您获得 Outlook 对象时,您需要执行以下操作:

Then when you get your Outlook object you need to do this:

Set olRemind = olApp.Reminders

其中 olApp 是您的 Outlook 应用程序对象.

Where olApp is your Outlook Application object.

现在在你的代码中你需要有这个事件:

Now in your code you need to have this event:

Private Sub olRemind_BeforeReminderShow(Cancel As Boolean)

WithEvents 放在顶部后,您将能够看到所有可以使用的事件.

Once you put the WithEvents at the top then you will be able to see all the events you can use.

现在您可以取消此活动,从而看不到提醒窗口.

Now you can cancel this event and thus not see the reminder window.

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

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