本文介绍了Outlook 2007 中的 ItemSend 事件中的密件抄送不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在 ItemSend
中插入了代码并保存了 ThisOutlookSession 模块.它工作一次,不再工作.它被保存为 VBAproject.OTM 并且在我重新启动 Outlook 后打开模块时仍然存在.
I inserted code in ItemSend
and saved the ThisOutlookSession module. It worked once and no longer works. It was saved as VBAproject.OTM and is still there when I open the module after restarting Outlook.
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
''# #### USER OPTIONS ####
''# address for Bcc -- must be SMTP address or resolvable
''# to a name in the address book
strBcc = "someone@somewhere.dom"
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
推荐答案
在项目的主题字段上使用和 if 语句
use and if statement on the Item's Subject field
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
If Item.Subject = "exact match" Then
strBcc = "someone@somewhere.dom"
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
Item.Save
Set objRecip = Nothing
End If
或者如果你想在主题中包含一个单词,请使用
or use if you want a contains a word in the subject
If InStr(Item.Subject, "BCCSubject") = 0 Then
End If
这篇关于Outlook 2007 中的 ItemSend 事件中的密件抄送不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
更多推荐
[db:关键词]
发布评论