简体   繁体   English

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

[英]Outlook Macro to add email to Bcc and send it

I have little VBA experience so I found a few post that were kinda like what I want but I can't seem to make them work.我几乎没有 VBA 经验,所以我发现了一些有点像我想要的帖子,但我似乎无法让它们工作。

I would like a to add an email address to outlook as a Bcc and send it.我想将电子邮件地址作为密件抄送添加到 Outlook 并发送。

It goes under thisOutlookSession它在 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM