Macro to prompt to add a cc address

Posted on 2006-11-15
Last Modified: 2008-02-01
Here is what I would like to have happen in our Outlook 2000:
When the user clicks "send", Outlook will see if the word "programming" exists in the subject line of the outbound email.  If it does, Outlook will prompt the user "Send a copy (CC:) to".
If the user clicks "yes", Outlook will then drop that email address in the CC field and send the message.
If the user clicks "no", Outlook will just send the message.

Can that be automated?
If yes, does that need to be done through a macro, a rule or both?

Question by:snyperj
  • 5
  • 4

Author Comment

ID: 17946395
An afterthought would be this:
If Outlook could first look at the CC: field to see if it the prompt is necessary- that would be a bigger homerun.
Some users are very good about entering the address as a CC: on their own.  Some arent.  :-)
LVL 35

Accepted Solution

mvidas earned 500 total points
ID: 17947355

You would have to do this using a macro.  Go to the macro editor (alt-f11), and in the ThisOutlookSession object, paste the following in (assuming you don't already have an _ItemSend event):

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
 If TypeName(Item) <> "MailItem" Then Exit Sub
 If InStr(1, Item.Subject, "programming", vbTextCompare) = 0 Then Exit Sub
 If InStr(1, Item.CC, "programming", vbTextCompare) > 0 Then Exit Sub
 Select Case MsgBox("Would you like to CC", vbYesNoCancel)
  Case vbCancel: Cancel = True
  Case vbYes: Item.CC = IIf(Len(Item.CC) > 0, Item.CC & "; ", "") & ""
 End Select
End Sub


Author Comment

ID: 17948152
Dang,  I was hoping there was someway around getting the "A program is trying to access email addresses you have stored in Outlook..." etc, etc.   by running the macro only if the CC field was blank, but not every time.

No option?

(We are unable to use redemption or ClickYes here due to company policy.)

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

LVL 35

Expert Comment

ID: 17948284
Are you able to install COM add-ins? There is one of those too that will do the same, and doesn't need to be started or anything. I can get the link if you can

But with later versions of outlook 2000, the security warning will pop up when the CC property gets accessed.  This is to prevent malicious code from reading the CC of a message, and sending spam out to any addresses in it.

Author Comment

ID: 17948524
No - we priobably can't install those either (but do post the link please.)

Your explanation in the CC field makes sense I guess.  Bummer.

Thanks for the code.
LVL 35

Expert Comment

ID: 17948587
The link for the addin is
You may want to try it; the only way I could see your IT dept limiting it is just preventing you from downloading it.  Installing it can be done a couple ways (the easiest is Tools / Options / Other / Advanced Options / COM AddIns / Add)

Let me know if you need anything else!

Author Comment

ID: 17948628
Thanks- I tried it.  I can download it OK, but because it is a setup.exe, when I run it I get pop-up login box to enter an administrator login which I of course don't have.
LVL 35

Expert Comment

ID: 17948710
Hmm.. I have been vigilant in sticking with my outlook 2000 SR1 here at work, so I have no need for that addin, but I'll take a look at it later and see if it is just an executable archive or something.  If so (assuming no readme's exist preventing this, don't want to break any rules here) I'll see if I can post the .dll file itself for you.  I'm sure your IT dept would help if the need really existed; the addin doesnt do anything aside from make this routine a little more convenient.
I'll let you know if I have any luck with it

Author Comment

ID: 17950535
Thanks.  It depends on who at IT here happens to get the request.  Some would help, some would stick to the book on policy.  No  uniformity- a whole different problem here.  Thanks for your help.

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Following basic email etiquette rules will help you write a professional email and achieve a good, lasting impression with your contacts.
This article lists the top 5 free OST to PST Converter Tools. These tools save a lot of time for users when they want to convert OST to PST after their exchange server is no longer available or some other critical issue with exchange server or impor…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…

813 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now