Macro to delay email

I'm new on macros and now I need to create a macro in Outlook 2010 for the followings:

Start with open a new message, To: XXX CC: XXX CCo: XXX
Then to programm or delay the email until a day and a specific hour.

I have to send emails everyday but I need them to be sent on a specific day. For example I have to send only on Mondays. I start with open a new message then put manually To, CC and CCo; after I have to go to options and Delay sent. This is for lots of emails each day.
Can anyone help me with this? Thanks in advance.
Can anyone help me please?

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

Sub DeferUntilMonday()

 

Dim mail As mailItem

Dim wkDay As Long

Dim sendTime As String

Dim sendMonday As Long

 

wkDay = Weekday(Date)

Debug.Print wkDay

' 1 = Sunday, 2 = Monday, 3 = Tuesday ...., 7 = Saturday

 

sendTime = "06:30:00"

 

Set mail = CreateItem(olMailItem)

 

mail.To = "*** Email address is removed for privacy ***"

mail.CC = "*** Email address is removed for privacy ***"

mail.BCC = "*** Email address is removed for privacy ***"

 

Select Case wkDay

 

    Case 1 ' Sunday

    sendMonday = 1

   

    Case Else

    sendMonday = 9 - wkDay

 

End Select

 

mail.DeferredDeliveryTime = (Date + sendMonday) & " " & sendTime

Debug.Print mail.DeferredDeliveryTime

 

mail.Display

 

ExitRoutine:

    Set mail = Nothing

   

End Sub

Consider clicking on the "Answer" link if a reply fixed your problem.

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

If today is Monday you might not want to defer to the following Monday in which case

Sub DeferUntilMonday()
Dim mail As MailItem
Dim wkDay As Long
Dim sendTime As String
Dim sendMonday As Long
    wkDay = Weekday(Date)
Debug.Print wkDay
    '1 = Sunday, 2 = Monday, 3 = Tuesday ...., 7 = Saturday
    sendTime = "06:30:00"
    Set mail = CreateItem(olMailItem)
    mail.To = "*** Email address is removed for privacy ***"
    mail.CC = "*** Email address is removed for privacy ***"
    mail.BCC = "*** Email address is removed for privacy ***"
    Select Case wkDay
        Case 1    ' Sunday
            sendMonday = 1
        Case 2    'Monday
            sendMonday = 0
        Case Else
            sendMonday = 9 - wkDay
    End Select
    If sendMonday > 0 Then
        mail.DeferredDeliveryTime = (Date + sendMonday) & " " & sendTime
    End If
Debug.Print (Date + sendMonday)
    mail.Display
ExitRoutine:
    Set mail = Nothing
End Sub

Graham Mayor (Microsoft Word MVP 2002-2019)
For more Word tips and downloads visit my web site
https://www.gmayor.com/Word_pages.htm

Was this reply helpful?

Sorry this didn't help.

Great! Thanks for your feedback.

How satisfied are you with this reply?

Thanks for your feedback, it helps us improve the site.

How satisfied are you with this reply?

Thanks for your feedback.

 
 

Question Info


Last updated September 30, 2021 Views 413 Applies to: