基于主题的自动BCC规则 [英] Rule for Auto BCC based on Subject
本文介绍了基于主题的自动BCC规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您好,
我有以下代码,我在Outlook 365中使用MVBA,自动BCC(到我的CRM)我发送的所有电子邮件,但我想要为了能够在没有BCC的情况下偶尔发送,如果主题行包括例如
" PRIVATE"?
i have the following code which i use in MVBA in Outlook 365, to automatically BCC (to my CRM) all emails that i send, however i want to be able to send without the BCC occasionally, how do i make it not add the BCC if the subject line includes for instance "PRIVATE"?
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objRecip As Recipient
Dim strMsg As String
Dim res As Integer
Dim strBcc As String
On Error Resume Next
strBcc = "crm@mycrm.com"
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
Set objRecip = Nothing
End Sub
期待任何评论,并提前感谢。
Look forward to any comments, and thanks in advance.
Arne Currie
Arne Currie
推荐答案
Hi lazylearnerguy,
Hi lazylearnerguy,
您可以使用InStr方法检查主题是否包含"私有"
You could use InStr method to check if Subject contains "Private"
以下是示例。
Dim strSubject As String
strSubject = Item.Subject
If InStr(strSubject, "PRIVATE") > 0 Then
Else
Set objRecip = Item.Recipients.Add(strBcc)
objRecip.Type = olBCC
If Not objRecip.Resolve Then
strMsg = "Could not resolve the Bcc recipient. " & _
"Do you want still to send the message?"
res = MsgBox(strMsg, vbYesNo + vbDefaultButton1, _
"Could Not Resolve Bcc Recipient")
If res = vbNo Then
Cancel = True
End If
End If
End If
最诚挚的问候,
Terry
这篇关于基于主题的自动BCC规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文