Outlook宏将电子邮件添加到密件抄送并发送

时间:2015-12-03 17:48:41

标签: vba outlook-vba

我的VBA经验很少,所以我发现了一些有点像我想要的帖子,但我似乎无法让它们发挥作用。

我想在Outlook中添加一个电子邮件地址作为密件抄送并发送。

1 个答案:

答案 0 :(得分:1)

它属于thisOutlookSession

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim olRecip As Recipient
    Dim olMsg As String
    Dim res As Integer
    Dim olBcc As String

    On Error Resume Next

    '// set email address here
    olBcc = "Address@domain.com"

    Set olRecip = Item.Recipients.Add(olBcc)
    olRecip.Type = olBcc
    If Not olRecip.Resolve Then
        olMsg = "Could not resolve Bcc recipient. " & _
                 "Do you still want to send?"
        res = MsgBox(olMsg, vbYesNo + vbDefaultButton1, _
                 "Could Not Resolve Bcc Recipient")
        If res = vbNo Then
            Cancel = True
        End If
    End If

    Set olRecip = Nothing
End Sub
相关问题