Prompt sender for cc

Posted on 2006-10-25
Last Modified: 2008-02-01
I've done some research and I've found several thrid party software add-ons for Outlook that do auto cc/bcc. Some even allow it to be determine by rules (based on email address or subject contents, for example). The problem we have is that there are too many variables to define a realistic set of rules. For example, we have inside sales support members that deal with 2 or more sales reps. Any email correspondonce (new or replies) with a sales rep's client must be cc:ed to that rep. However, non-client related email or email to clients that don't have an assigned rep, don't need to be cc:ed to anyone.

What would be the best solution for us is if when inside support person generates (or replies to) an email that a prompt comes up to select a person to cc but have the ability to send the message whether or not they have entered/selected someone to carbon copy. I would be will to entertain any solution as long as end users can work directly from Outlook.

Thanks in advance for thought-provoking advice, recommendations or comments.
Question by:djinIT
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 5
LVL 76

Expert Comment

by:David Lee
ID: 17806540
Hi djinIT,

You can do this via code by trapping the Application_ItemSend event.  This occurs every time an item is sent.  You'd need to first determine if it's a mail item, and then somehow determine if it's from an inside support person.  If yes to both, then display a dialog-box asking if they want to CC the message to someone.  If they enter an address, then add it to the CC line.  If not, then allow the send to continue.


Author Comment

ID: 17821984
Hi BDF -

If this is code that can be applied on a per client basis then I would then only need to determine if its mail. How difficult is this to do? Or better question how exactly do I get started?
LVL 76

Expert Comment

by:David Lee
ID: 17827264

Here's the solution I described.  Follow these instructions to use it.  

1.  Start Outlook
2.  Click Tools->Macro->Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code and paste it into the right-hand pane of the VB Editor window
5.  Click the diskette icon on the toolbar to save the changes
6.  Close the VB Editor
7.  Click Tools->Macro->Security
8.  Set the Security Level to Medium
9.  Close Outlook
10.  Start Outlook
11.  Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run.  Say yes.

This solution checks all outgoing items.  If an item is an email message and is from an inside sales rep, then it pops up a dialog-box asking them if they need to copy a sales rep.  At the moment I am forcing all messages to meet the inside sales rep test because I don't know how you want to go about determining that.  The user enters or does not enter an address or addresses.  Those addresses are then added to the message and the message is sent.  If they don't enter any address, then the message goes as is.

You asked in your last post if this code "can be applied on a per client basis".  The answer is that it depends on what you have in mind.  If you mean that you'd like it to checnk who the message is going to and act accordingly, then the answer is yes, but with a caveat.  Reading an address field from code will trigger Outlook's built in security.  This will cause a security warning dialog-box to pop up warning that an application is accessing your mailbox and asking if you want to allow it to continue.  You have to click the Yes button for the code to continue.  There are three ways around this  One, write the code as an Outlook add-in.  Add-ins have different security rules, but they are also more difficult to write.  Two, use Click-Yes (  This utility sits in the system tray and watches for that security dialog-box.  When it appears, it clicks the Yes button for you.  Three, use Outlook Redemption (  This component library safely circumvents Outlook security, allowing the code to do its job.  If you want to use either of the last two, then I can modify the code to check who the message is addressed to and take action based on the result.

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Const IsInsideSalesRep = True
    Dim strAddresses As String
    If Item.Class = olMail Then
        If IsInsideSalesRep Then
            strAddresses = InputBox("If this message is to a client, then enter the email address of the client's sales rep." & vbCrLf & "If there are mutliple addressees, then separate them with a a semicolon (;)", "Address to Sales Rep")
            If strAddresses <> "" Then
                If Item.CC = "" Then
                    Item.CC = strAddresses
                    Item.CC = Item.CC & ";" & strAddresses
                End If
            End If
        End If
    End If
End Sub
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.


Author Comment

ID: 17836638
Thanks BDF. I'll look into the workarounds #2 and #3 to see what will work best for us. Further, I'll try out the code this afternoon and get back to you tomorrow. Thanks much for your efforst thus far.


Author Comment

ID: 17843847
At startup I did get the message about enabling macros. Answered to the affirmative. Wrote and replied various test emails but I don't get prompted to enter anything. Messages are sent as normal.

And to clarify, I do want this script to generate the popup dialog box when sending any email message (new or replied).
LVL 76

Accepted Solution

David Lee earned 350 total points
ID: 17848782
For some reason Outlook sometimes doesn't run macros even after enabling them.  Typically the cure for that is to explicitly run a macro.  Afterwards, Outlook appears to recognize that macros are enabled.  Add the macro below to Module1, then run it by clicking Tools->Macro->Macros, selecting this macro, and clicking Run.  All it does is create a blank message and display it onscreen.  When the message appears you can simply close it.  Then try sending something again and let me know what happens.

Sub ForceMacros()
    Dim olkItem As Outlook.MailItem
    Set olkItem = Application.CreateItem(olMailItem)
    Set olkItem = Nothing
End Sub

Author Comment

ID: 17850950
I exported and then deleted all my modules so I could start fresh. That did the trick. So I'm assigning you points and an "A". I do have a couple of inquiries.

When I hit "send" at first I thought Oultook froze because the dialog box didn't pop up. I then realized the box is indeed popping up but its hidden behind the email message. Is there a way to control that and make sure its always on top? And lastly, the addresses that sender would cc to are all in our global address list. I know I'm being really picky but is it possible to have display the address list? Or maybe even have a couple default addresses display and the user can simply delete one or both address from the popup?
LVL 76

Expert Comment

by:David Lee
ID: 17888247
I'll check into possible ways to ensure the dialog-box appears as the foremost window.  Displaying the address list is possible, but it'd require more complicated code and possibly the creation of a user form..  

Author Comment

ID: 17888596
Sounds good BDF. If its easier to code two default addresses then that would definitely suffice. User could simply delete one or both. Thanks!
LVL 76

Expert Comment

by:David Lee
ID: 17916739
I don't know of a way to make the dialog-box the topmost window in Outlook.  Adding mutliple addresses to the dialog-box is simple though.  Simply replace the line with the InputBox command with the one below.

    strAddresses = InputBox("If this message is to a client, then enter the email address of the client's sales rep." & vbCrLf & "If there are mutliple addressees, then separate them with a a semicolon (;)", "Address to Sales Rep", ";")

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
exchange 2007 5 53
scheduled email to be sent question. 3 33
smooth change in outlook from IMAP to POP 24 65
MS Outlook, pst file exceeds maximum size 6 38
If you don't know how to downgrade, my instructions below should be helpful.
Find out what you should include to make the best professional email signature for your organization.
CodeTwo Sync for iCloud ( automatically synchronizes your Outlook 2016, 2013, 2010 or 2007 folders with iCloud folders available via iCloud Control Panel. This lets you automatically sync them with…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question