?
Solved

Outlook 2010 - How can I get prompted to populate the CC field when sending an email?

Posted on 2014-12-04
4
Medium Priority
?
104 Views
Last Modified: 2014-12-15
When I click send mail, I would like a choice to cc a group.  If yes, add the addresses to the cc field, if choice is no, dont.  How would I do that?  I have limited experience with vba.

Thanks for any help that you can provide.
0
Comment
Question by:Michael Spellman
[X]
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
  • 3
4 Comments
 
LVL 26

Accepted Solution

by:
Nick67 earned 2000 total points
ID: 40481294
This works, but the message box has a habit of getting behind Outlook or the mail message, causing grief
Substitute TheNameOfYourGroup with the appropriate thing
Code MUST go in ThisOutlookSession

Option Explicit
Public WithEvents m_Inspectors As Outlook.Inspectors
Public WithEvents m_Inspector As Outlook.Inspector
Public WithEvents myitem As Outlook.MailItem

Private Sub Application_Startup()
  Set m_Inspectors = Application.Inspectors
End Sub

Private Sub m_Inspectors_NewInspector(ByVal Inspector As Outlook.Inspector)
  Set m_Inspector = Inspector
End Sub
'
Private Sub m_Inspector_Activate()
On Error GoTo exiterr
'is this item a mail item
If Not m_Inspector.CurrentItem.Class = OlObjectClass.olMail Then
    Set m_Inspector = Nothing
    Exit Sub
Else
    Set myitem = m_Inspector.CurrentItem
End If
Exit Sub
exiterr:
Set m_Inspector = Nothing
Set myitem = Nothing
End Sub
Private Sub myitem_Send(Cancel As Boolean)
Dim msg As Integer
    msg = MsgBox("Do you want to CC the group?", vbYesNo+ vbSystemModal, "CC?")
    If (msg = vbNo) Then ' no, then bail
        Set myitem = Nothing
        Exit Sub
    Else
        Dim ns As Outlook.NameSpace
        Dim Folder As Outlook.MAPIFolder
        Set ns = Outlook.GetNamespace("MAPI")
        Set Folder = ns.GetDefaultFolder(olFolderInbox)
        Dim objOutlookRecip As Outlook.Recipient
        Set objOutlookRecip = myitem.Recipients.Add("TheNameOfYourGroup")
        objOutlookRecip.Type = olCC
    ' Resolve each Recipient's name.
    For Each objOutlookRecip In myitem.Recipients
        objOutlookRecip.Resolve
    Next
    End If
End Sub

Open in new window

0
 

Author Comment

by:Michael Spellman
ID: 40482613
I placed the code in the ThisOutlookSession but I don't get the message box when I click on send.  Is there something else needed to trigger the event?  Thanks for the help.
0
 

Author Comment

by:Michael Spellman
ID: 40482628
I just checked the security settings and they were disabling the code.  It works fine.  Thanks very much!
0
 

Author Comment

by:Michael Spellman
ID: 40490890
Excellent!  I really appreciate it.
0

Featured Post

Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!

Question has a verified solution.

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

Microsoft Office Picture Manager was included in Office 2003, 2007, and 2010, but not in Office 2013. Users had hopes that it would be in Office 2016/Office 365, but it is not. Fortunately, the same zero-cost technique that works to install it with …
Today companies are subjected to more-and-more data, and it won't stop any time soon.  But there are obvious opportunities for reducing data, particularly data duplicated among companies.
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.
Suggested Courses

800 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