EDS
EDS

Reputation: 9

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.

I would like a to add an email address to outlook as a Bcc and send it.

Upvotes: 0

Views: 1738

Answers (1)

0m3r
0m3r

Reputation: 12499

It goes under 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 = "[email protected]"

    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

Upvotes: 1

Related Questions