After I reinstalled Outlook 2010, my code to BBC automatically doesn't work anymore! Any ideas to make it work again? Many thanks!
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 myOlApp As Outlook.Application
Dim myOlMsg As Outlook.MailItem
On Error Resume Next
' create outlook objects for referance
Set myOlApp = CreateObject("Outlook.Application")
Set myMsg = myOlApp.ActiveInspector.CurrentItem
' address to BCC
strBcc = "[email protected]"
' if the sender address is the support account utilize bcc
If myMsg.SenderEmailAddress = "[email protected]" Then
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
Set objRecip = Nothing
End If
End Sub
FYI, I put this VBA script in "ThisOutlookSession" object
FYI again,
I've done with the "send me a copy of every mail I send" with some tips in "Rule and Alert", but still want to know why this code doesnt work.