Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 = "LongNX@fsoft.com.vn"

' if the sender address is the support account utilize bcc
If myMsg.SenderEmailAddress = "LongNX@fsoft.com.vn" 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 my vba location 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.

share|improve this question
    
where are you pasting this code? did you compile it? put a simple messagebox saying something in code to see if your code is being executed in first place. –  tumchaaditya Jun 19 '12 at 4:38
1  
Did you restart Outlook and digitally sign your project? –  JimmyPena Jun 19 '12 at 20:37
    
Sorry, I don't know how to "digitally sign your project", please show me a guide . Thanks! –  LongTTH Jun 20 '12 at 2:25

1 Answer 1

Check Macro Security level http://www.slipstick.com/outlook-developer/how-to-use-outlooks-vba-editor/ Outlook 2010: File, Options, Trust Center, Macros.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.