在Outlook (2016或365)中,我想使用VBA创建一个规则来移动我发送给特定人的项目。
我已经完成了大部分代码(从Microsoft代码示例中提取),但是我不知道条件字段应该得到什么。我知道这是不对的(在这种类型的对象中没有".sender“这样的东西),但是我不知道我应该把什么放在那里。ToOrFromRuleCondition上只有七个属性(应用程序、类、ConditionType、已启用、父级、收件人和会话),它们都不处理发送方。
在以下守则中:
Set colRules = Application.Session.DefaultStore.GetRules()
Set objRuleSend = colRules.Create(RuleName & "Send", olRuleSend)
Set objToCondition = objRuleSend.Conditions.SentTo
With objToCondition
.Enabled = True
.Sender = Address ' <-- this is the line that fails.
.Recipients.ResolveAll
End With发布于 2018-01-31 21:11:41
您可以拦截Application.ItemSend事件,检查收件人是否正确,然后将MailItem.SaveSentMessageFolder属性设置为正确的文件夹。
发布于 2019-03-13 08:38:07
这应该能行
Set colRules = Application.Session.DefaultStore.GetRules()
Set objRuleSend = colRules.Create(RuleName & "Send", olRuleSend)
Set objToCondition = objRuleSend.Conditions.SentTo
With objToCondition
.Enabled = True
.Recipients.Add Address ' <-- this is the line that is fixed.
.Recipients.ResolveAll
End Withhttps://stackoverflow.com/questions/48551325
复制相似问题