跳到主要内容

如何更改 Outlook 中延迟交付的默认时间?

添加一名作者 最后修改时间:2023-06-02

启用延迟交付选项时( 请勿提前交付 对于 Outlook 中的电子邮件,发送时间默认设置为下午 5:00。 假设你工作到很晚,不想让别人知道你在加班。 您需要在发送电子邮件之前为您的电子邮件启用延迟递送选项。 启用该选项后,您需要手动更改默认发送时间。 否则,电子邮件将在第二天下午 5:00 之后发送。 有没有办法改变这个默认的交货时间?

本教程提供了一个 VBA 代码来帮助您更改 Outlook 中延迟交付选项的默认时间。


使用 VBA 代码更改 Outlook 中延迟交付的默认时间

您可以应用以下 VBA 代码来更改 Outlook 中延迟传递选项的默认时间。

在以下 VBA 代码中:

您可以指定两次: 延迟交货时间延迟交付选项启用时间.

例如,您将延迟交付时间设置为上午 07:30,并将延迟交付选项设置为在下午 5:30 之后自动启用。 当您在 07:30 AM - 5:30 PM 期间发送电子邮件时,电子邮件将直接发送。 如果在下午 5:30 至上午 07:30 期间发送电子邮件,则将安排在第二天上午 07:30 之后发送。

请按如下方式测试脚本。

1.启动Outlook,按 其他 + F11 同时打开 Microsoft Visual Basic应用程序 窗口。

2.在 Microsoft Visual Basic应用程序 窗口,双击 Project1 > Microsoft Outlook对象 > 本次展望会议 打开 ThisOutlookSession(代码) 窗口,然后将以下代码复制到此代码窗口中。

VBA代码:更改Outlook中延迟交付的默认时间

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by Extendoffice & EWP 20230602
  Const xDelayTime As String = "07:30:00"  'The delay delivery time of emails
  Const xCompareTime As String = "17:30:00" 'The time to enable the delay delivery option
  Dim xMail As Outlook.MailItem
  Dim xWeekday As Integer
  Dim xNowTime As String
  Dim xIsDelay As Boolean
  Dim xRet1 As Integer
  Dim xRet2 As Integer
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  xWeekday = Weekday(Date, vbMonday)
  xNowTime = Format(Now, "hh:nn:ss")
  xIsDelay = False
  xRet1 = StrComp(xNowTime, xDelayTime)
  xRet2 = StrComp(xNowTime, xCompareTime)
  If xRet1 = xRet2 Then
    xIsDelay = True
  End If
  If (xRet1 = -1) And (xRet2 = -1) Then
    xMail.DeferredDeliveryTime = Date & " " & xDelayTime
  Else
    If ((xWeekday = 5) And xIsDelay) Or (xWeekday = 6) Or (xWeekday = 7) Then
      xMail.DeferredDeliveryTime = (Date + (5 - xWeekday + 3)) & " " & xDelayTime
    ElseIf xIsDelay Then
      xMail.DeferredDeliveryTime = (Date + 1) & " " & xDelayTime
    End If
  End If
Exit Sub
xError:
  MsgBox "ItemSend: " & Err.Description, , "Kutools for Outlook"
End Sub

笔记:

1) 您可以在以下几行中更改延迟时间和启用延迟交付选项的时间。
常量 xDelayTime As String = "07:30:00"
常量 xCompareTime As String = "17:30:00"
2) 周末发送电子邮件时,将安排在周一上午 07:30 之后发送。

3.保存代码,然后按 其他 + Q 关闭键 Microsoft Visual Basic应用程序 窗口。

从现在开始,当您在上午 07:30 - 下午 5:30 发送电子邮件时,将直接发送电子邮件。 如果在下午 5:30 至上午 07:30 期间发送电子邮件,则将安排在下一个工作日上午 07:30 之后发送。


相关文章

在 Outlook 中更改全天事件的默认提醒时间
通常,全天事件的默认提醒时间在Outlook 18/2007中为2010小时,在Outlook 0.5中为2013天。有时,全天事件的默认提醒时间可能与您的工作计划不一致。 在这里,我们将介绍在Microsoft Outlook中更改全天活动的默认提醒时间的方法。

更改 Outlook 中的默认跟进时间
众所周知,当我们在Outlook中为电子邮件添加跟进提醒时,默认的跟进时间为4:30 PM(或其他时间取决于您的工作时间)。 但是,您可能需要更改默认的跟进时间,并让它在工作时间开始时提醒您,例如9:00 AM。 在本文中,我将向您展示如何在Outlook中更改默认的跟进时间。

更改 Outlook 中的默认存档位置
默认情况下,Outlook具有存档文件的默认位置。 除了默认位置,您还可以为存档文件设置自己的存档位置。 在本教程中,我们将详细向您展示如何在Outlook中更改默认存档位置。

在Outlook中更改默认附件保存位置
您是否对每次启动Outlook时都指定的附件位置感到厌烦? 在本教程中,我们将向您展示如何更改默认附件位置。 此后,即使重新启动Outlook,每次保存附件时,也会自动打开指定的附件保存文件夹。

在 Outlook 中将全天事件默认设置为忙碌
默认情况下,Outlook 将约会和会议的状态设置为“忙碌”,但将全天活动设置为“空闲”(参见下面的屏幕截图)。 每次创建全天事件时,您都需要手动将 Show As 状态更改为 Busy。 要将全天事件的默认显示状态更改为忙碌,本文为您提供了两种方法。


最佳办公生产力工具

最新消息:Kutools for Outlook 发布 免费版本!

体验全新的 Kutools for Outlook 免费版本拥有 70 多项令人难以置信的功能,您可以永久使用! 点击立即下载!

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

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

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

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

🌟 界面魔法: 😊更多又漂亮又酷的表情符号   /  收到重要邮件时提醒您  /  最小化 Outlook 而不是关闭 ...

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

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

只需单击一下即可立即解锁 Kutools for Outlook -永久免费. 别等了, 立即下载并提高您的效率!

kutools for outlook 功能1 kutools for outlook 功能2
 

 

 

Comments (42)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hi,
Would there be a way to change only the default delay time and NOT the time to enable the delay delivery option?
This comment was minimized by the moderator on the site
Hi

So useful! Can you add the option that if you are sending to people from within your organisation, this rule does not apply and emails are sent immediately?
This comment was minimized by the moderator on the site
Hi Crystal

This was just what I was looking for, it worked once, and I was very excited! Since then no matter what time of day, the emails send as soon as I click "Send". Any thoughts on what I've done wrong? I'd also love to be able to exclude 'high importance' flags.
This comment was minimized by the moderator on the site
Please ignore that request, seems it was to do with trust settings. Sorted now, thanks for the code!
This comment was minimized by the moderator on the site
I found that when you send an email on Sunday it is push to a week out as xMail.DeferredDeliveryTime = (Date + (vbSaturday - xWeekday + 2)) & " " & xDelayTime ends up with 8 days in the future instead of the expected one. As 7 (vbSaturday) - 1 (xWeekday on Sunday) + 2 is 8. This is my fix:
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by EWP 20230518
  Const xDelayTime As String = "07:30:00"  'The delay delivery time of emails
  Const xCompareTime As String = "17:30:00" 'The time to enable the delay delivery option
  Dim xMail As Outlook.MailItem
  Dim xWeekday As Integer
  Dim xNowTime As String
  Dim xIsDelay As Boolean
  Dim xRet1 As Integer
  Dim xRet2 As Integer
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  xWeekday = Weekday(Date, vbMonday)
  xNowTime = Format(Now, "hh:nn:ss")
  xIsDelay = False
  xRet1 = StrComp(xNowTime, xDelayTime)
  xRet2 = StrComp(xNowTime, xCompareTime)
  If xRet1 = xRet2 Then
    xIsDelay = True
  End If
  If (xRet1 = -1) And (xRet2 = -1) Then
    xMail.DeferredDeliveryTime = Date & " " & xDelayTime
  Else
    If ((xWeekday = 5) And xIsDelay) Or (xWeekday = 6) Or (xWeekday = 7) Then
      xMail.DeferredDeliveryTime = (Date + (5 - xWeekday + 3)) & " " & xDelayTime
    ElseIf xIsDelay Then
      xMail.DeferredDeliveryTime = (Date + 1) & " " & xDelayTime
    End If
  End If
Exit Sub
xError:
  MsgBox "ItemSend: " & Err.Description, , "Kutools for Outlook"
End Sub
This comment was minimized by the moderator on the site
Hi Ehrin Pitts,

Thank you for the correction. I will check the code in the post and correct it.
This comment was minimized by the moderator on the site
This is a most useful piece of code, because it prevents me from disturbing people outside office hours.
However, I sometimes need to send an email outside normal hours and it is a nuisance to comment out the VBA code each time.
My suggestion is that if the "Importance" flage is set to high, then the mail will be sent immediately and not be delayed. Would it be possible for you to add such an exclusion in the code. (Still keeping the existing code, including the line with the xSenderAddress).
This comment was minimized by the moderator on the site
Hi Bernard,

The following VBA code helps to exclude the emails with a high importance flag. Please give it a try.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by Extendoffice 20230410
  Const xDelayTime As String = "07:30:00"  'The delay delivery time of emails
  Const xCompareTime As String = "17:30:00" 'The time to enable the delay delivery option
  Dim xMail As Outlook.MailItem
  Dim xWeekday As Integer
  Dim xNowTime As String
  Dim xIsDelay As Boolean
  Dim xRet1 As Integer
  Dim xRet2 As Integer
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  If xMail.Importance = olImportanceHigh Then Exit Sub 'Exclude emails with a high importance flag
  xWeekday = Weekday(Date, vbSunday)
  xNowTime = Format(Now, "hh:nn:ss")
  xIsDelay = False
  xRet1 = StrComp(xNowTime, xDelayTime)
  xRet2 = StrComp(xNowTime, xCompareTime)
  If xRet1 = xRet2 Then
    xIsDelay = True
  End If
  If (xRet1 = -1) And (xRet2 = -1) Then
    xMail.DeferredDeliveryTime = Date & " " & xDelayTime
  Else
    If ((xWeekday = vbFriday) And xIsDelay) Or (xWeekday = vbSaturday) Or (xWeekday = vbSunday) Then
      xMail.DeferredDeliveryTime = (Date + (vbSaturday - xWeekday + 2)) & " " & xDelayTime
    ElseIf xIsDelay Then
      xMail.DeferredDeliveryTime = (Date + 1) & " " & xDelayTime
    End If
  End If
Exit Sub
xError:
  MsgBox "ItemSend: " & Err.Description, , "Kutools for Outlook"
End Sub
There are no comments posted here yet
Load More
Leave your comments
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations