Skip i'r prif gynnwys

Sut i newid yr amser rhagosodedig ar gyfer oedi wrth gyflwyno yn Outlook?

Wrth alluogi'r opsiwn dosbarthu oedi (y Peidiwch â danfon o'r blaen opsiwn yn y sgrin ganlynol) ar gyfer e-bost yn Outlook, mae'r amser anfon wedi'i osod i 5:00 PM yn ddiofyn. Gan dybio eich bod yn gweithio'n hwyr yn y nos ac nad ydych am i eraill wybod eich bod yn gweithio goramser. Mae angen i chi alluogi'r opsiwn oedi wrth anfon eich e-byst cyn eu hanfon. Ar ôl galluogi'r opsiwn, mae angen i chi newid yr amser anfon rhagosodedig â llaw. Fel arall, bydd yr e-bost yn cael ei anfon ar ôl 5:00 PM y diwrnod canlynol. A oes unrhyw ffordd i newid yr amser dosbarthu rhagosodedig hwn?

Mae'r tiwtorial hwn yn darparu cod VBA i'ch helpu chi i newid yr amser rhagosodedig ar gyfer yr opsiwn dosbarthu oedi yn Outlook.


Newidiwch yr amser rhagosodedig ar gyfer oedi wrth gyflwyno Outlook gyda chod VBA

Gallwch chi gymhwyso'r cod VBA canlynol i newid yr amser rhagosodedig ar gyfer yr opsiwn dosbarthu oedi yn Outlook.

Yn y cod VBA canlynol:

Gallwch nodi dwy waith: y oedi amser cyflwyno a oedi cyflwyno opsiwn galluogi amser.

Er enghraifft, rydych chi'n gosod yr amser dosbarthu oedi i 07:30 AM ac yn gosod yr opsiwn dosbarthu oedi i'w alluogi'n awtomatig ar ôl 5:30 PM. Pan fyddwch yn anfon e-bost yn ystod 07:30 AM - 5:30 PM, bydd yr e-bost yn cael ei anfon yn uniongyrchol. Os anfonir e-bost rhwng 5:30 PM - 07:30 AM, bydd yn cael ei anfon ar ôl 07:30 AM y diwrnod canlynol.

Profwch y sgript fel a ganlyn.

1. Lansio eich Rhagolwg, pwyswch y Alt + F11 allweddi ar yr un pryd i agor y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

2. Yn y Microsoft Visual Basic ar gyfer Ceisiadau ffenestr, cliciwch ddwywaith ar Project1 > Gwrthrychau Microsoft Outlook > SesiwnOutlook i agor y ThisOutlookSession (Cod) ffenestr, ac yna copïwch y cod canlynol i'r ffenestr cod hon.

Cod VBA: newid yr amser rhagosodedig ar gyfer oedi wrth gyflwyno yn 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

Nodiadau:

1) Gallwch newid yr amser oedi a'r amser i alluogi'r opsiwn dosbarthu oedi yn y llinellau canlynol.
Const xDelayTime As String = "07:30:00"
Const xCompareTime As String = "17:30:00"
2) Wrth anfon e-bost ar benwythnosau, bydd yn cael ei anfon ar ôl 07:30 AM ddydd Llun.

3. Cadwch y cod a gwasgwch y Alt + Q allweddi i gau'r Microsoft Visual Basic ar gyfer Ceisiadau ffenestr.

O hyn ymlaen, pan fyddwch yn anfon e-bost yn ystod 07:30 AM - 5:30 PM, bydd yr e-bost yn cael ei anfon yn uniongyrchol. Os anfonir e-bost rhwng 5:30 PM - 07:30 AM, bydd yn cael ei anfon ar ôl 07:30 AM y diwrnod gwaith nesaf.


Erthyglau perthnasol

Newid Amser Atgoffa Rhagosodedig O Ddigwyddiadau Trwy'r Dydd Yn Outlook
Fel rheol, amser atgoffa diofyn y digwyddiad trwy'r dydd yw 18 awr yn Outlook 2007/2010 a 0.5 diwrnod yn Outlook 2013. Weithiau, efallai na fydd amser atgoffa diofyn y digwyddiad trwy'r dydd yn cytuno â'ch amserlen waith. Yma byddwn yn cyflwyno'r ffordd i newid amser atgoffa diofyn digwyddiadau trwy'r dydd yn Microsoft Outlook.

Newidiwch yr Amser Dilynol Diofyn Yn Outlook
Fel y gwyddom, pan fyddwn yn ychwanegu nodyn atgoffa dilynol ar gyfer e-bost yn Outlook, yr amser dilynol diofyn yw 4:30 PM (neu amser arall yn dibynnu ar eich oriau gwaith). Fodd bynnag, efallai yr hoffech chi newid yr amser dilynol diofyn, a gadael iddo eich atgoffa ar ddechrau oriau gwaith, fel 9:00 AM. Yn yr erthygl hon, byddaf yn dangos i chi sut i newid yr amser dilynol diofyn yn Outlook.

Newid Lleoliad Archif Rhagosodedig Yn Outlook
Yn ddiofyn, mae gan Outlook leoliad diofyn ar gyfer y ffeiliau archif. Heblaw am y lleoliad diofyn, gallwch chi osod eich lleoliad archif eich hun ar gyfer eich ffeiliau archif. Yn y tiwtorial hwn, byddwn yn dangos i chi sut i newid lleoliad archif diofyn yn Outlook yn fanwl.

Newid Lleoliad Arbed Ymlyniad Rhagosodedig yn Rhagolwg
Ydych chi wedi cael llond bol ar ddod o hyd i leoliad yr atodiad rydych chi wedi'i nodi bob tro wrth lansio Outlook? Yn y tiwtorial hwn, byddwn yn dangos i chi sut i newid lleoliad yr atodiad diofyn. Ar ôl hynny, bydd y ffolder arbed atodiadau penodedig yn cael ei agor yn awtomatig bob tro y byddwch chi'n arbed yr atodiadau er eich bod chi'n ailgychwyn yr Outlook.

Newidiwch y Rhagosodiad Digwyddiad Trwy'r Dydd I Prysur Yn Outlook
Yn ddiofyn, mae Outlook yn gosod statws apwyntiadau a chyfarfodydd i “Prysur”, ond digwyddiadau trwy'r dydd i “Am Ddim” (gweler y llun isod). Mae angen i chi newid y statws Show As â llaw i Prysur bob tro y byddwch chi'n creu digwyddiad diwrnod cyfan. I newid y sioe ddiofyn fel statws digwyddiadau diwrnod cyfan i Busy, mae'r erthygl yn rhoi dau ddull i chi.


Offer Cynhyrchiant Swyddfa Gorau

Kutools ar gyfer Rhagolwg - Dros 100 o Nodweddion Pwerus i Werthu Eich Outlook

🤖 Cynorthwy-ydd Post AI: E-byst pro ar unwaith gyda hud AI - un clic i atebion athrylith, tôn berffaith, meistrolaeth amlieithog. Trawsnewid e-bostio yn ddiymdrech! ...

📧 E-bostio Automation: Allan o'r Swyddfa (Ar gael ar gyfer POP ac IMAP)  /  Amserlen Anfon E-byst  /  Auto CC/BCC gan Reolau Wrth Anfon E-bost  /  Awto Ymlaen (Rheolau Uwch)   /  Auto Ychwanegu Cyfarchiad   /  Rhannwch E-byst Aml-Dderbynnydd yn Negeseuon Unigol yn Awtomatig ...

📨 Rheoli E-bost: Dwyn i gof E-byst yn Hawdd  /  Rhwystro E-byst Sgam gan Bynciau ac Eraill  /  Dileu E-byst Dyblyg  /  Chwilio Manwl  /  Cydgrynhoi Ffolderi ...

📁 Ymlyniadau ProArbed Swp  /  Swp Datgysylltu  /  Cywasgu Swp  /  Auto Achub   /  Datgysylltiad Auto  /  Cywasgiad Auto ...

🌟 Rhyngwyneb Hud: 😊Mwy o Emojis Pretty a Cŵl   /  Rhowch hwb i'ch Cynhyrchiant Outlook gyda Golygfeydd Tabbed  /  Lleihau Outlook Yn lle Cau ...

???? Rhyfeddodau un clic: Ateb Pawb ag Ymlyniadau Dod i Mewn  /   E-byst Gwrth-Gwe-rwydo  /  🕘Dangos Parth Amser yr Anfonwr ...

👩🏼‍🤝‍👩🏻 Cysylltiadau a Chalendr: Swp Ychwanegu Cysylltiadau O E-byst Dethol  /  Rhannwch Grŵp Cyswllt i Grwpiau Unigol  /  Dileu Atgoffa Pen-blwydd ...

Dros Nodweddion 100 Aros Eich Archwiliad! Cliciwch Yma i Ddarganfod Mwy.

 

 

Comments (41)
No ratings yet. Be the first to rate!
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).
This comment was minimized by the moderator on the site
This is awesome.

This is a longshot - but i have work and personal accounts in Outlook. Is there a way to set this only for certain accounts?
This comment was minimized by the moderator on the site
Hi Ann,
The following VBA script may help. Please give it a try.
In this line: xAccount = "Your email account", please replace the text "You email account" with your own account. For multiple accounts, please use a semicolon ";" to separate them.

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
  Dim xSenderAddress As String
  Dim xAccount As String
  On Error GoTo xError
  If (Item.Class <> olMail) Then Exit Sub
  Set xMail = Item
  xSenderAddress = ""
  xSenderAddress = xMail.SendUsingAccount.SmtpAddress
  xAccount = "Your email account"  'Specify your email account here and use ; to separate different accounts
  If VBA.InStr(xAccount, xSenderAddress) = 0 Then Exit Sub
  xWeekday = Weekday(Date, vbSunday)
  xNowTime = Format(Now, "hh:nn:ss")
  xIsDelay = False
  If StrComp(xNowTime, xDelayTime) = StrComp(xNowTime, xCompareTime) Then
    xIsDelay = True
  End If
  Debug.Print xIsDelay
  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
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