跳到主要内容

如何防止Outlook提醒太早或太晚?

例如,您每天的工作时间是从上午9:00到下午6:00,但是现在您要在上午10:00进行约会,并在Outlook中为其添加2个小时的提醒。 这意味着提醒将在工作开始前的8:00生效。 另一方面,在特殊情况下,提醒可能会在午夜响起。 这非常不方便,某些Outlook用户可能希望阻止Outlook提早或过晚提醒。 在这里,我将介绍一个VBA宏供您在Outlook中解决。

Office 选项卡 - 在 Microsoft Office 中启用选项卡式编辑和浏览,让工作变得轻而易举
Kutools for Outlook - 通过 100 多个高级功能增强 Outlook,实现卓越效率
使用这些高级功能增强您的 Outlook 2021 - 2010 或 Outlook 365。 享受全面的 60 天免费试用并提升您的电子邮件体验!

为防止Outlook提醒得太早或太晚,您可以执行以下操作:

步骤1:按下 其他 + F11 同时按键以打开“ Microsoft Visual Basic for Applications”窗口。

步骤2:展开 Microsoft Outlook对象 在左窗格中,然后将以下VBA宏粘贴到 本次展望会议.

VBA:防止在Outlook中过早或过晚提醒

Public WithEvents g_CalendarItems As Outlook.Items
Public Sub Application_Startup()
Set g_CalendarItems = Outlook.Session.GetDefaultFolder(olFolderCalendar).Items
End Sub
Private Sub g_CalendarItems_ItemAdd(ByVal Item As Object)
CheckReminder Item
End Sub
Private Sub g_CalendarItems_ItemChange(ByVal Item As Object)
CheckReminder Item
End Sub
Sub CheckReminder(ByVal Item As Object)
On Error GoTo ProcError
Dim strProcName As String
strProcName = "CheckReminder"
reminderMaxHour = 20
reminderMinHour = 9
Dim aAptItem As Outlook.AppointmentItem
Set aAptItem = Item
If aAptItem.ReminderSet Then
Dim reminderDate As Date
reminderDate = aAptItem.Start - aAptItem.ReminderMinutesBeforeStart / (24 * 60)
reminderHour = (reminderDate - Int(reminderDate)) * 24
tolerance = 0.01 ' avoid floating point small diffs (little bit less than a min)
If reminderHour < reminderMinHour - tolerance Or reminderHour > reminderMaxHour + tolerance Then
' best guess, first try to advance to next minHour
reminderDateSuggestion = reminderDate + (reminderMinHour - reminderHour) / 24
' verify if first guess is valid
If reminderHour < reminderMinHour - tolerance And reminderDateSuggestion <= aAptItem.Start Then
' OK, first guess is valid, keep it
ElseIf reminderHour > reminderMaxHour Then
' go back to max hour (same day)
reminderDateSuggestion = reminderDate - (reminderHour - reminderMaxHour) / 24
Else
' go back to max hour (previous day)
reminderDateSuggestion = reminderDate - (reminderHour + 24 - reminderMaxHour) / 24
End If
rep = MsgBox("The Reminder time is out of specified working period. Would you like to change the Reminder time?" , vbQuestion + vbYesNoCancel)
If rep = vbCancel Then
aAptItem.Display
ElseIf rep = vbYes Then
aAptItem.ReminderMinutesBeforeStart = (aAptItem.Start - reminderDateSuggestion) * 24 * 60
aAptItem.Save
End If
End If
End If
ProcExit:
Exit Sub
ProcError:
MsgBox "Unanticipated error " & Err.Number & " " & Err.Description & vbCrLf & "In procedure: " & strProcName
End Sub

 

备注:您可以通过更改上面的VBA代码中的以下参数来指定工作时间:
hinterMaxHour = 20
hinterMinHour = 9

步骤3:保存此VBA,然后重新启动Microsoft Outlook。

从现在开始,当您在没有指定提醒时间的情况下创建带提醒时间的约会时,在您单击“开始”后,将弹出一个对话框提醒您。 保存并关闭 按钮。

如果提醒时间早于指定的提醒时间MinHour,请单击 在对话框中,它将更改提醒时间,并在指定的hinterMinHour发出提醒声音。

如果提醒时间晚于指定的提醒MaxHour,请单击 在对话框中,它将更改提醒时间,并在指定的hinterMaxHour提醒您。

请注意: 此VBA代码可与Outlook 2013完美配合,但不适用于Outlook 2010和2007。


最佳办公生产力工具

Kutools for Outlook - 超过 100 种强大功能可增强您的 Outlook

🤖 人工智能邮件助手: 具有人工智能魔力的即时专业电子邮件——一键天才回复、完美语气、多语言掌握。轻松改变电子邮件! ...

📧 电子邮件自动化: 外出(适用于 POP 和 IMAP)  /  安排发送电子邮件  /  发送电子邮件时按规则自动抄送/密件抄送  /  自动转发(高级规则)   /  自动添加问候语   /  自动将多收件人电子邮件拆分为单独的消息 ...

📨 电子邮件管理: 轻松回忆电子邮件  /  按主题和其他人阻止诈骗电子邮件  /  删除重复的电子邮件  /  高级搜索  /  合并文件夹 ...

📁 附件专业版批量保存  /  批量分离  /  批量压缩  /  自动保存   /  自动分离  /  自动压缩 ...

🌟 界面魔法: 😊更多又漂亮又酷的表情符号   /  使用选项卡式视图提高 Outlook 工作效率  /  最小化 Outlook 而不是关闭 ...

👍 一键奇迹: 使用传入附件回复全部  /   反网络钓鱼电子邮件  /  🕘显示发件人的时区 ...

👩🏼‍🤝‍👩🏻 通讯录和日历: 从选定的电子邮件中批量添加联系人  /  将联系人组拆分为各个组  /  删除生日提醒 ...

超过 100特点 等待您的探索! 单击此处了解更多。

了解更多       免费下载      购买
 

 

Comments (0)
No ratings yet. Be the first to rate!
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations