Hello fellow Excelers
I am using the code below as part of a module to send emails. My query is simple, with two parts.
I would like to add in an agrument to set the "Do not deliver before" option in the email. In doing so, how could I code this so that it sets the value to todays date at 1800hrs?
Any and all help is appreciated.
Regards,
Damian.
Code
Set olApp = New Outlook.Application 'prepare new instance of Outlook
Set olNewMail = CreateItem(olMailItem) 'prepare to create new mail item
sendTo = strMailcode & rngCell 'define recipient
With olNewMail
With .Recipients.Add(sendTo) 'create new email with recipient
.Type = olTo
If Not .Resolve Then 'check if recipient exists in contacts folder
MsgBox "Cannot find recipient: " & sendTo, vbInformation 'recipient does not exist report to user
LogEvent "Emailing error - cannot find recipient: " & sendTo 'log the error
GoTo Name_Error 'continue with next entry
End If
End With
.Subject = "Switchboard Directory Updates" 'add email subject
.Attachments.Add "\\UKSCCI03\xxxxxxxx\Directory Verification Utility\Procedures\PROACTIVE UPDATES - RECIPIENT INSTRUCTIONS.DOC", olByValue, 1, "Instructions" 'add instruction attachment
.Attachments.Add "C:\TEMP\OUTPUT.XLS", olByValue, 2, sendTo 'add data attachment
.Body = Chr(11) & Chr(11) & "This E-mail has been sent from xxxxx. Please open the Word Document for instruction. Thank you." & Chr(13) _
& Chr(13) & "If you have any queries regarding this e-mail, please dial switchboard on xxx and ask for a member of the Directory Update Team." & Chr(13) & Chr(13) & "If all details within are correct, no response is necessary" _
& Chr(13) & Chr(13) & "If your response should be returned as a 'send failure', please route your response to xxxxxx.co.uk"
.Send 'send email
End With
Display More