[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Outlook Macros (cc address)

Posted on 2015-02-04
6
Medium Priority
?
211 Views
Last Modified: 2015-03-23
Hi Guys,

What is the easiest way in MS Outlook to include a CC e-mail address automatically upon completing a "specific" TO address.

I guess we will have to write a macro for every combination between TO & CC addresses?
0
Comment
Question by:Rupert Eghardt
[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
  • 2
6 Comments
 
LVL 31

Expert Comment

by:gowflow
ID: 40590678
Macro can do it and rules are there for this purpose.
gowflow
0
 
LVL 76

Expert Comment

by:David Lee
ID: 40590810
Hi, Rupert.

If by "completing" you mean a solution that automatically inserts a CC as soon as you enter/select and address on the To line, then you'd want to find/build an add-in.  Macros aren't going to work and neither will rules.  A macro will work if you want to add the CC automatically when the user sends the message.  Rules won't work for that either since rules only fire when messages arrive and after they are sent.  

The code would look something like this.  This code would run each time you send something.  It first checks to see if the item is an email.  If it is, then it checks each of the message's addressees.  If the addressee is on the "To" line, then it checks their name against a list of names you've supplied (i.e. the names in the CASE statement).  If it finds a match, then it adds one or more addressees to the CC line.  When it's all done checking the addressees, it saves any changes to the message (i.e. the newly added CC addresses) and the message goes on its way.  You can add as many checks as you need.  The only requirement is that the name you check for must exactly match a name in the list of people on the To line.  

Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
    Dim olkRec As Outlook.Recipient, strCC As String
    If Item.Class = olMail Then
        For Each olkRec In Item.Recipients
            If olkRec.Type = olTo Then
                Select Case olkRec.Name
                    Case "John"
                        strCC = strCC & "Bill@company.com;"
                    Case "Sally"
                        strCC = strCC & "Sam@company.com;Susie@company.com"
                End Select
            Next
        End If
        If Len(strCC) > 0 Then
            strCC = Left(strCC, Len(strCC) - 1)
            Item.CC = strCC
            Item.Save
        End If
    End If
End Sub

Open in new window

0
 

Author Comment

by:Rupert Eghardt
ID: 40607522
Thank you BlueDevilFan!

I am sure this will give us what we need.
The only problem that I see is that we have to modify the script with each "condition" being added.

I guess it will complicate things a lot to make it read from a table containing the condition / CC-Result fields?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 76

Expert Comment

by:David Lee
ID: 40613910
No, it wouldn't complicate things a lot to read the condition info from a table.  Where do you envision the table being stored and in what format?
0
 

Author Comment

by:Rupert Eghardt
ID: 40616025
I followed up with the user and they are happy to insert a fixed list of conditions / CC-results in the script for now.
We don't have to configure a table at this time.

How do I link the script in Outlook to action every time a message is sent?
0
 
LVL 76

Accepted Solution

by:
David Lee earned 2000 total points
ID: 40616291
To use the script

1.  Start Outlook
2.  Press ALT+F11 to open the Visual Basic Editor
3.  If not already expanded, expand Microsoft Office Outlook Objects and click on ThisOutlookSession
4.  Copy the code from the code snippet box and paste it into the right-hand pane of Outlook’s VB Editor window
5.  Edit the code as needed
6.  Click the diskette icon on the toolbar to save the changes
7.  Close the VB Editor
8.  Click Tools > Trust Center
9.  Click Macro Security
10. Set Macro Security to “Warnings for all macros”
11. Click OK
12. Close Outlook
12. Start Outlook. Outlook will display a dialog-box warning that ThisOutlookSession contains macros and asking if you want to allow them to run. Say yes.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying 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

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…
Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

656 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