有谁知道如何将当前规则名称解析为Outlook VBA
例如,请使用下面的代码
末尾的行可以使用colrules.item语句中的数字,该语句将返回由数字指定的规则,或者如果您知道规则的名称,则可以显式,因此在示例中如果您知道规则被称为“我的规则”,您可以称之为
但是我不想要其中任何一个,当我不知道规则名称或其索引号时,我想返回调用此脚本的当前规则的名称
Public Sub saveAttachtoDisk(itm As Outlook.MailItem)
Dim objAtt As Outlook.Attachment
Dim orule As Outlook.Rule 'this will be the specific rule
Dim colrules As Outlook.Rules 'this will be the collection of rules, this is needed first to choose the specific rule from
'Firstly we will get the current rule into our script so we can use the rule name to parse the vendor account into the filename
Set colrules = Application.Session.DefaultStore.GetRules() ' get the collection of rules
' choose the specific rule that called this script
Stop
Set orule = colrules.Item(1)
Set orule = colrules.Item("My Rule")
答案 0 :(得分:0)
不幸的是,没有办法确定当前规则,或者某些规则被解雇。