I have created the below code which emails a workbook automatically and I would like to flag the sent email with a sender follow-up 2 days from the sent date to remind me to follow up the sent email in 2 days.
I have looked at other forums without success and the code that I have found only sets the flag for the recipient.
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Dim wb As Workbook
Dim FileName As String
Dim wSht As Worksheet
Dim ShtName As String
Dim ws As Worksheet
ActiveWorkbook.SaveCopyAs ThisWorkbook.Path & "\" & "File Name " & Format(Now, "dd-mm-yy") & ".xlsm"
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.createitem(0)
strbody = " Please see the attached spreadsheet.
" & _"Please don't hesitate to contact me if you have any questions.
"
'Change only Mysig.htm to the name of your signature
SigString = Environ("appdata") & _
"\Microsoft\Signatures\Expediting Officer.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.To = ""
.CC = ""
.BCC = ""
.Subject = ""
.HTMLBody = strbody & "
" & Signature
.display
.Attachments.Add ("File location"\"File Name " & Format(Now, "dd-mm-yy") & ".xlsm")
.display
.Importance = 2
End With
The MailItem class provides the following properties to get the job done:
See the sample code:
Public Sub FlagMessage(Item As Outlook.MailItem)
With Item
.MarkAsTask olMarkThisWeek
' sets a due date in 48 hours
.TaskDueDate = Now + 2
.ReminderSet = True
.ReminderTime = Now + 2
.Save
End With
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.