Nov 14 2022 01:02 AM - edited Nov 14 2022 02:06 AM
I would like to have an email to be triggered automatically on every Monday at a specific timing without executing the macro manually.
How can i amend the code below?
Private Sub sendemail_EBS_outsourcefiles()
Dim outapp As Object
Dim outmail As Object
Set outapp = CreateObject("outlook.application")
Set outmail = outapp.createitem(0)
dtToday = Date
prevdate = DateAdd("n", 0, Now)
daysName = Format(Date, "dddd")
If daysName = "Monday" Then
'On Error Resume Next
With outmail
.To = "email address removed for privacy reasons"
.CC = ""
.BCC = ""
.Subject = "Test File " & Format(Date, "dd-Mmm-yy")
.Display
.HTMLBody = "Test test"
.DeferredDeliveryTime = prevdate
End With
End If
Debug.Print daysName
Set outapp = Nothing
Set outmail = Nothing
End Sub
appreciate the help in advance..
Nov 14 2022 07:30 AM
SolutionNov 14 2022 05:50 PM
@Jan Karel Pieterse , thanks and appreciate the help!
Nov 14 2022 07:30 AM
Solution