Outlook 2007中的ItemSend事件中的BCC不再有效 [英] BCC in ItemSend event in Outlook 2007 no longer works

查看:226
本文介绍了Outlook 2007中的ItemSend事件中的BCC不再有效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 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事件中的BCC不再有效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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