Automatic BCC from Outlook (VBA)

Hello,

I am trying to create a subroutine in outlook to send an automatic BCC to a
certain 'mail recipient (a@b.c)' if the subject contains 'xyz'. I have
managed to create a subroutine which applys to EVERY mail i send. I want to
set it for certain 'subjects' rather if subject contains 'xyz. What do i
have to add Please help or guide me to resources. I need to know a subject
field which i could compare strings with, i guess.

-----------------------
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim objMe As Recipient
Set objMe = Item.Recipients.Add("a@b.c")
objMe.Type = olBCC
objMe.Resolve
Set objMe = Nothing

End Sub
-----------------------


Thanks in advance,



Answer this question

Automatic BCC from Outlook (VBA)

  • Matt Gradwohl

    This is a non-VSTO question, so I moved this thread to the VBA Forum.

    Thanks!

    Mike Hernandez
    Community Program Manager
    VSTO Team


  • YT76

    What you need is API for "subject". Try this:

    In VBA IDE (Alt-F11), Press F2, (Assume you already the outlook library referred), input "subject" in the second combobox and click "search" icon. It comes with list of object with subject property. The one you are looking for is mailitem.subject.

    I hope this would help.


  • Automatic BCC from Outlook (VBA)