ไปยังเนื้อหาหลัก

จะเปลี่ยนเวลาเริ่มต้นสำหรับการจัดส่งล่าช้าใน Outlook ได้อย่างไร

เมื่อเปิดใช้งานตัวเลือกการจัดส่งล่าช้า (the ห้ามส่งก่อน ในภาพหน้าจอต่อไปนี้) สำหรับอีเมลใน Outlook เวลาที่ส่งถูกตั้งค่าเป็น 5 น. ตามค่าเริ่มต้น สมมติว่าคุณทำงานดึกและไม่ต้องการให้คนอื่นรู้ว่าคุณทำงานล่วงเวลา คุณต้องเปิดใช้งานตัวเลือกการจัดส่งล่าช้าสำหรับอีเมลของคุณก่อนที่จะส่ง หลังจากเปิดใช้งานตัวเลือกนี้ คุณต้องเปลี่ยนเวลาเริ่มต้นในการส่งด้วยตนเอง มิฉะนั้น อีเมลจะถูกส่งหลัง 00 น. ของวันถัดไป มีวิธีใดในการเปลี่ยนแปลงเวลาจัดส่งเริ่มต้นนี้หรือไม่?

บทช่วยสอนนี้มีรหัส VBA เพื่อช่วยคุณเปลี่ยนเวลาเริ่มต้นสำหรับตัวเลือกการจัดส่งล่าช้าใน Outlook


เปลี่ยนเวลาเริ่มต้นสำหรับการจัดส่งล่าช้าใน Outlook ด้วยรหัส VBA

คุณสามารถใช้รหัส VBA ต่อไปนี้เพื่อเปลี่ยนเวลาเริ่มต้นสำหรับตัวเลือกการจัดส่งล่าช้าใน Outlook

ในรหัส VBA ต่อไปนี้:

คุณสามารถระบุสองครั้ง: the เวลาจัดส่งล่าช้า และ ตัวเลือกการจัดส่งล่าช้า เปิดใช้งานเวลา.

ตัวอย่างเช่น คุณตั้งเวลาการจัดส่งล่าช้าเป็น 07:30 น. และตั้งค่าตัวเลือกการจัดส่งล่าช้าให้เปิดใช้งานโดยอัตโนมัติหลัง 5:30 น. เมื่อคุณส่งอีเมลระหว่างเวลา 07:30 น. - 5:30 น. อีเมลจะถูกส่งโดยตรง หากส่งอีเมลระหว่างเวลา 5 น. – 30 น. จะมีกำหนดส่งหลัง 07 น. ของวันถัดไป

โปรดทดสอบสคริปต์ดังต่อไปนี้

1. เปิดโปรแกรม Outlook ของคุณกดปุ่ม อื่น ๆ + F11 พร้อมกันเพื่อเปิดไฟล์ Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

2 ใน Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง ดับเบิลคลิกที่ Project1 > วัตถุ Microsoft Outlook > นี้OutlookSession เพื่อเปิด 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) คุณสามารถเปลี่ยนเวลาหน่วงและเวลาเพื่อเปิดใช้งานตัวเลือกการจัดส่งล่าช้าในบรรทัดต่อไปนี้
Const xDelayTime As String = "07:30:00"
Const xCompareTime As String = "17:30:00"
2) เมื่อส่งอีเมลในวันหยุดสุดสัปดาห์จะมีกำหนดส่งหลัง 07:30 น. ในวันจันทร์

3. บันทึกรหัสแล้วกดปุ่ม อื่น ๆ + Q ปุ่มเพื่อปิดไฟล์ Microsoft Visual Basic สำหรับแอปพลิเคชัน หน้าต่าง

จากนี้ไป เมื่อคุณส่งอีเมลระหว่างเวลา 07:30 - 5:30 น. อีเมลจะถูกส่งตรงไป หากส่งอีเมลระหว่างเวลา 5 น. – 30 น. จะมีกำหนดส่งหลัง 07 น. ของวันทำการถัดไป


บทความที่เกี่ยวข้อง

เปลี่ยนเวลาเตือนเริ่มต้นของกิจกรรมตลอดทั้งวันใน Outlook
โดยปกติเวลาเตือนความจำเริ่มต้นของกิจกรรมตลอดวันคือ 18 ชั่วโมงใน Outlook 2007/2010 และ 0.5 วันใน Outlook 2013 บางครั้งเวลาเตือนความจำเริ่มต้นของกิจกรรมตลอดวันอาจไม่ตรงกับกำหนดการทำงานของคุณ ที่นี่เราจะแนะนำวิธีการเปลี่ยนเวลาเตือนความจำเริ่มต้นของกิจกรรมตลอดทั้งวันใน Microsoft Outlook

เปลี่ยนเวลาติดตามเริ่มต้นใน Outlook
ดังที่เราทราบเมื่อเราเพิ่มการแจ้งเตือนการติดตามสำหรับอีเมลใน Outlook เวลาติดตามเริ่มต้นคือ 4 น. (หรือเวลาอื่นขึ้นอยู่กับเวลาทำงานของคุณ) อย่างไรก็ตามคุณอาจต้องการเปลี่ยนเวลาติดตามผลเริ่มต้นและให้เวลานั้นเตือนคุณในช่วงเริ่มต้นของเวลาทำงานเช่น 30 น. ในบทความนี้ฉันจะแสดงวิธีเปลี่ยนเวลาติดตามผลเริ่มต้นใน Outlook

เปลี่ยนตำแหน่งเก็บถาวรเริ่มต้นใน Outlook
ตามค่าเริ่มต้น Outlook จะมีตำแหน่งเริ่มต้นสำหรับไฟล์ที่เก็บถาวร นอกจากตำแหน่งเริ่มต้นคุณสามารถตั้งค่าตำแหน่งที่เก็บถาวรสำหรับไฟล์เก็บถาวรของคุณได้ ในบทช่วยสอนนี้เราจะแสดงวิธีเปลี่ยนตำแหน่งที่เก็บถาวรเริ่มต้นใน Outlook โดยละเอียด

เปลี่ยนตำแหน่งเริ่มต้นการบันทึกไฟล์แนบใน Outlook
คุณเบื่อกับการค้นหาตำแหน่งไฟล์แนบที่คุณระบุทุกครั้งเมื่อเปิด Outlook หรือไม่? ในบทช่วยสอนนี้เราจะแสดงวิธีเปลี่ยนตำแหน่งไฟล์แนบเริ่มต้น หลังจากนั้นโฟลเดอร์บันทึกไฟล์แนบที่ระบุจะเปิดโดยอัตโนมัติทุกครั้งที่คุณบันทึกไฟล์แนบแม้ว่าคุณจะเริ่ม Outlook ใหม่

เปลี่ยนค่าเริ่มต้นของกิจกรรมตลอดทั้งวันเป็นไม่ว่างใน Outlook
ตามค่าเริ่มต้น Outlook จะตั้งค่าสถานะของการนัดหมายและการประชุมเป็น "ไม่ว่าง" แต่กิจกรรมตลอดทั้งวันเป็น "ฟรี" (ดูภาพหน้าจอด้านล่าง) คุณต้องเปลี่ยนสถานะ "แสดงเป็น" เป็น "ไม่ว่าง" ด้วยตนเองทุกครั้งที่สร้างกิจกรรมตลอดทั้งวัน ในการเปลี่ยนการแสดงเริ่มต้นเป็นสถานะของกิจกรรมตลอดทั้งวันเป็นไม่ว่าง บทความนี้มีวิธีการสองวิธีให้คุณ


สุดยอดเครื่องมือเพิ่มผลผลิตในสำนักงาน

Kutools สำหรับ Outlook - คุณสมบัติอันทรงพลังมากกว่า 100 รายการเพื่อเติมพลังให้กับ Outlook ของคุณ

🤖 ผู้ช่วยจดหมาย AI: ส่งอีเมลระดับมืออาชีพทันทีด้วยเวทมนตร์ AI คลิกเพียงครั้งเดียวเพื่อตอบกลับอย่างชาญฉลาด น้ำเสียงที่สมบูรณ์แบบ การเรียนรู้หลายภาษา เปลี่ยนรูปแบบการส่งอีเมลอย่างง่ายดาย! ...

📧 การทำงานอัตโนมัติของอีเมล: ไม่อยู่ที่สำนักงาน (ใช้ได้กับ POP และ IMAP)  /  กำหนดการส่งอีเมล  /  Auto CC/BCC ตามกฎเมื่อส่งอีเมล  /  ส่งต่ออัตโนมัติ (กฎขั้นสูง)   /  เพิ่มคำทักทายอัตโนมัติ   /  แบ่งอีเมลผู้รับหลายรายออกเป็นข้อความส่วนตัวโดยอัตโนมัติ ...

📨 การจัดการอีเมล์: เรียกคืนอีเมลได้อย่างง่ายดาย  /  บล็อกอีเมลหลอกลวงตามหัวเรื่องและอื่นๆ  /  ลบอีเมลที่ซ้ำกัน  /  การค้นหาขั้นสูง  /  รวมโฟลเดอร์ ...

📁 ไฟล์แนบโปรบันทึกแบทช์  /  การแยกแบทช์  /  การบีบอัดแบบแบตช์  /  บันทึกอัตโนมัติ   /  ถอดอัตโนมัติ  /  บีบอัดอัตโนมัติ ...

🌟 อินเตอร์เฟซเมจิก: 😊อีโมจิที่สวยและเจ๋งยิ่งขึ้น   /  เพิ่มประสิทธิภาพการทำงาน Outlook ของคุณด้วยมุมมองแบบแท็บ  /  ลดขนาด Outlook แทนที่จะปิด ...

???? เพียงคลิกเดียวสิ่งมหัศจรรย์: ตอบกลับทั้งหมดด้วยไฟล์แนบที่เข้ามา  /   อีเมลต่อต้านฟิชชิ่ง  /  🕘 แสดงโซนเวลาของผู้ส่ง ...

👩🏼‍🤝‍👩🏻 รายชื่อและปฏิทิน: แบทช์เพิ่มผู้ติดต่อจากอีเมลที่เลือก  /  แบ่งกลุ่มผู้ติดต่อเป็นกลุ่มแต่ละกลุ่ม  /  ลบการแจ้งเตือนวันเกิด ...

เกิน คุณสมบัติ 100 รอการสำรวจของคุณ! คลิกที่นี่เพื่อค้นพบเพิ่มเติม

 

 

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
This comment was minimized by the moderator on the site
Thanks for this macro. I often work late in the evenings or early in the mornings but don't want emails to be sent to my colleagues outside of normal working hours (for me, 08:00 to 17:45, which I've modified in the macro myself).

Is there a way to add an additional clause to the macro for sending emails, please? Currently, if I work early in the morning on a weekday (say 06:00, before the working day officially starts at 08:00) then the macro will delay sending until 08:00 on the following working day. I would rather the email was sent at 08:00 on the current working day. I tested your macro on a Thursday morning at 07:54 and the sending has been delayed until 08:00 on Friday, whereas I would want it to be sent on Thursday at 08:00.

Emails sent after the end of the working day should be sent at the start of the next working day, as you have written. Any emails sent at any time on Saturday or Sunday should be sent at the start of the next working day, again as you have written.

It's been a while since I've written anything substantial in VBA so I'm turning my head inside out trying to find the solution, with no success.
This comment was minimized by the moderator on the site
Hi Dom,

I am sorry to reply to you so late. The following VBA code can help. Please give it a try.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by Extendoffice 20230410
  Const xDelayTime As String = "08:00:00"  'The delay delivery time of emails
  Const xCompareTime As String = "17:45: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
  Dim xDelayInterval As Integer
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  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
This comment was minimized by the moderator on the site
Hi Crystal, the issue returned. No matter what time of day, the emails send as soon as I click "Send". Please let me know any advice. Thank you
This comment was minimized by the moderator on the site
Hi Angela,

The problem was reproduced in my case and we have updated the code. Please give it a try. Thank you for your comment.
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
'Updated by Extendoffice 20230117
  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
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  xWeekday = Weekday(Date, vbSunday)
  xNowTime = Format(Now, "hh:nn:ss")
  xIsDelay = False
  If StrComp(xNowTime, xDelayTime) = StrComp(xNowTime, xCompareTime) Then
    xIsDelay = True
  End If
  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
Exit Sub
xError:
  MsgBox "ItemSend: " & Err.Description, , "Kutools for Outlook"
End Sub
This comment was minimized by the moderator on the site
Hi Crystal,
I fixed the issue by closing the Outlook application and re-opening it after saving the VBA code. Thank you for this!
This comment was minimized by the moderator on the site
Hi Crystal, I followed your instructions and enabled macros, but the emails are still sending as soon as I click "Send".

I have Outlook version 2101 (Build 13628.20274).

1. I did not modify any variables in the code, so it is saved just as you have instructed for "ThisOutlookSession".
2. It is the only code in "ThisOutlookSession".
3. The current time is 3:19 AM Eastern Time, so I would expect the emails to be delayed upon clicking "Send" since I am attempting to send an email during the time period of 5:30 PM - 07:30 AM.
4. I verified the Macros are enabled.

Is there anything else you can suggest that could cause this macro not to work? Thank you

From the tutorial: "From now on, when you send an email during 07:30 AM - 5:30 PM, the email will be sent directly. If an email is sent during 5:30 PM – 07:30 AM, it will be scheduled to send after 07:30 AM the next workday."
This comment was minimized by the moderator on the site
Hi Crystal, I followed your instructions and enabled macros, but the emails are still sending as soon as I click "Send". I have Outlook version 2101 (Build 13628.20274).
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations