Hi there
I am using the code below to BCC a group of people but I only want it to work when sending from one account (because I send automated mail from excel from Item(4) account I don't want the question of BCC being asked!).
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
Dim acc As Outlook.Application
On Error Resume Next
Set acc = CreateObject("Outlook.Application")
If acc.Session.Accounts.Item(1) Then
res = MsgBox("Do you want to add Fringe BCC's?", vbYesNo, "Add Fringe contacts to BCC?")
If res = vbNo Then Exit Sub
strBcc = "BCC Fringe"
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
End If
Set objRecip = Nothing
Set acc = Nothing
End Sub
The code in red is what I thought would do this but in runs true regardless of the account I'm sending from.
What have I done wrong?
Any help appreciated, thanks
Paul Ked