宏仅在certin时间段中传递邮件 [英] Macro to only deliver mails in a certin timeperiode

查看:74
本文介绍了宏仅在certin时间段中传递邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为我和我的大学设置一个宏(使用VBA),以确保更好的工作环境。这包括在工作时间之后不发送电子邮件。 (或者更确切地说 - 在工作时间之后不接收电子邮件)。

我写了一些伪代码,我希望能帮到大家都明白我想要的是:

 

如果收件人地址包括(文本)检查优先级:

            
如果piority很高 - 发送电子邮件。

             If piority is high – send email.

              如果p riority低 - 请检查当前时间

             If priority is low – check current time of day

如果时间是早上6点到下午4点 - 发送电子邮件

如果时间不是早上6点到下午4点 - 请将电子邮件延迟到早上6点 - 然后发送

 

我相信最后两个步骤是最困难的。我将不胜感激。

提前谢谢。

推荐答案

您好,

如果您想将代码分发到另一个机器,我建议开发一个加载项。 VBA宏不是为在另一台机器上移动它们而设计的,这正是发明加载项的原因。

If you want to distribute your code on another machines, I'd suggest developing an add-in instead. VBA macros are not designed for moving them on another machines, that is exactly for what add-ins was invented.

无论如何,您可以使用计时器安排所有提交的电子邮件,即在指定的时间范围内发送。

ItemSend
Application类的事件允许您取消发送过程,将准备好的电子邮件保存在任何地方,然后在您需要的任何地方发送邮件。只要用户通过  Inspector   (在
之前,检查员关闭,但在用户点击 
发​​送   按钮)或  发送   方法
for Outlook项目,例如&NBSP ;
MailItem
用于程序。

Anyway, you can use a timer to schedule all submitted emails, i.e. send them at the specified time frame. The ItemSend event of the Application class allows you to cancel the sending procedure, save the prepared email anywhere and then send mails later wherever you need. It is fired whenever an Microsoft Outlook item is sent, either by the user through an Inspector (before the inspector is closed, but after the user clicks the Send button) or when the Send method for an Outlook item, such as MailItem, is used in a program.

您可以找到以下内容链接有用:

You may find the following links helpful:

如何自动化Outlook另一个程序

Outlook 2010中的VBA入门

如何:以编程方式创建和发送Outlook消息

如何:以编程方式填写Outlook中的TO,CC和BCC字段

如何:Chang使用C#或VB.NET发送之前的Outlook电子邮件


这篇关于宏仅在certin时间段中传递邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆