Consulting

Results 1 to 2 of 2

Thread: Automatically BCC/CC Send

  1. #1
    VBAX Newbie
    Joined
    Jan 2019
    Posts
    1
    Location

    Post Automatically BCC/CC Send

    Hello all,

    I am looking a VBA code that puts my colleagues into BCC when I use a specific email domain address.

    For example;

    Ekran Alıntısı.jpg

    And example code which is works but not on the way that I want;


    **original website

    So can you please help me to make some adjustments to optimize the code,

    Best Regards,

    Podious

  2. #2
    You just have to check the domain and add the recipients e.g.

    Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim objRecip As Recipient
    Dim Res As Integer
    Dim strAccount As String
    Dim strMessage As String
    Const strDomain As String = "yourdomain.com"
    Const strBCC1 As String = "emailaddress1"
    Const strBCC2 As String = "emailaddress2"
        strAccount = Split(Item.SendUsingAccount.DisplayName, "@")(1)
        If strAccount = strDomain Then
            Set objRecip = Item.Recipients.Add(strBCC1)
            objRecip.Type = olBCC
            If Not objRecip.Resolve Then
                Res = MsgBox("Could not resolve the BCC Recipient " & strBCC1 & vbCr & "Do you want to send the message", vbYesNo)
                If Res = vbNo Then Cancel = True
                Set objRecip = Nothing
            End If
            Set objRecip = Item.Recipients.Add(strBCC2)
            objRecip.Type = olBCC
            If Not objRecip.Resolve Then
                Res = MsgBox("Could not resolve the BCC Recipient " & strBCC2 & vbCr & "Do you want to send the message", vbYesNo)
                If Res = vbNo Then Cancel = True
                Set objRecip = Nothing
            End If
        End If
        Set objRecip = Nothing
    End Sub
    Graham Mayor - MS MVP (Word) 2002-2019
    Visit my web site for more programming tips and ready made processes
    http://www.gmayor.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •