vba 从 Excel 发送带有后续提醒的电子邮件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17129272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-11 21:40:26  来源:igfitidea点击:

Send an Email from Excel with Follow-Up Reminder

excelvbaoutlook

提问by ARich

I've a macro that replaces a manual process of copy/pasting data from a workbook into a new email and then sending that email to several dynamic recipients (based on the workbook data).

我有一个宏,它取代了将工作簿中的数据复制/粘贴到新电子邮件中,然后将该电子邮件发送给多个动态收件人(基于工作簿数据)的手动过程。

When done manually, the email is set to high importance (which I have replicated via VBA) and a follow-up reminder is set for the recipient, not the sender.

手动完成后,电子邮件设置为高重要性(我已通过 VBA 复制),并为收件人而不是发件人设置后续提醒

To be clear, the process does not involve sending a task or meeting with due dates and the like. A follow-up reminder is set to remind the recipient to take action on the email content a few hours before a due date that's posted in the body of the email.

需要明确的是,该过程不涉及发送任务或召开具有截止日期的会议等。后续提醒设置为提醒收件人在电子邮件正文中发布的截止日期前几个小时对电子邮件内容采取措施。

I came across this forum post: [http://www.pcreview.co.uk/forums/setting-reminder-flag-vba-e-mails-sent-users-t3966711.html][1].
Towards the bottom of the post, Sue Mosher suggests that this may not be possible via VBA considering the possible drawbacks.

我遇到了这个论坛帖子:[ http://www.pcreview.co.uk/forums/setting-reminder-flag-vba-e-mails-sent-users-t3966711.html][1]
在帖子的底部,Sue Mosher 建议考虑到可能存在的缺点,这可能无法通过 VBA 实现。

Is there a way to set a follow-up reminder in a VBA-generated email?

有没有办法在 VBA 生成的电子邮件中设置跟进提醒?

回答by ARich

Dim MyItem as Outlook.MailItem

With MyItem
            .To = EmailAddr
            .Subject = sSubject
            .SentOnBehalfOfName = "[email protected]"
            .HTMLBody = Msg
            .Importance = olImportanceHigh
            .FlagStatus = olFlagMarked
            .FlagRequest = "Follow up"
            .FlagDueBy = Range("F2").Value & " 10:08 AM"
End With

The main parts being .FlagStatus, .FlagRequest, and .FlagDueBy. With .FlagDueBy, I used a dynamic date in my workbook to set the due date, but a hard due date could be coded like so, FlagDueBy = "1/1/1900 12:00 AM".

主要部件是.FlagStatus.FlagRequest.FlagDueBy。使用.FlagDueBy,我在我的工作簿中使用动态日期来设置截止日期,但硬截止日期可以像这样编码,FlagDueBy = "1/1/1900 12:00 AM"