简体   繁体   English

Excel 2010 VBA Outlook电子邮件发件人后续标记

[英]Excel 2010 VBA Outlook Email Sender Follow-up Tag

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. 我创建了下面的代码,该代码自动向工作簿发送电子邮件,并且我希望在发送日期起2天之内以发件人的后续操作标记已发送的电子邮件,以提醒我在2天内进行后续操作。

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: MailItem类提供以下属性来完成工作:

  • MarkAsTask - marks a MailItem object as a task and assigns a task interval for the object. MarkAsTask-将MailItem对象标记为任务,并为该对象分配任务间隔。
  • TaskDueDate - sets a Date value that represents the due date of the task for this MailItem. TaskDueDate-设置一个Date值,该值表示此MailItem的任务的截止日期。
  • ReminderSet - sets a Boolean value that is True if a reminder has been set for this item. ReminderSet-如果为此项目设置了提醒 ,则将布尔值设置为True。
  • ReminderTime - sets a Date indicating the date and time at which the reminder should occur for the specified item. ReminderTime-设置一个Date,该日期指示应该对指定项目进行提醒的日期和时间。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM