Sending standard reply to selected messages.

Posted on 2005-05-05
Last Modified: 2008-02-01
Greetings friends:

HEre at work I get a lot of e-mail which require a standard reply and its a real pain in the backside having to cut and paste all the timne.

I tried creating a Rule but deciding which messgae should get what reply is somewhat of a subjective thing, even though it does not take that long to do.

What I would like to know if there is a way that I can select a group of messages and reply to all of them with the same exact message, preferably preserving the SUBJECT and TO field of each message and filling in the same values for the  FROM, CC, CCO fields.

I'm open to just about any kind of solution be it adding a button and a VBScript, using macros, or 3rd party software.

Anyhelp would be geratly appreciated,

Thanks in advance!

Question by:FourHorsemen
    LVL 76

    Expert Comment

    by:David Lee
    Hi FourHorsemen,

    I wrote a macro that does something very similar to this.  I'll look for it in a minute and post it if I find it.  Otherwise, if no one else has responded by then I'll write a new one.  This isn't very difficult.  Will it always be the same reply or would you like to choose from a list of standard replies?


    Author Comment

    If I could choose from a list it would be even better..but just being able to send one standard reply wiill help me a great deal.  Thanks in advance!
    LVL 76

    Expert Comment

    by:David Lee
    I finally found that other question.  Here's a link to it.  Have a look and if it looks close then let me know and we'll work on fixing it up to meet your needs.

    Author Comment

    Hmmm...can't see the link
    LVL 76

    Expert Comment

    by:David Lee
    Doh!  Sorry, the mind really is the first thing to go.  Here's the link:

    Author Comment

    OK BlueDevilFan...that code looks pretty darn good :) My respects to you!

    Now is there a way that I can have it so that the response will be sent to two and only two addresses (One TO, One CC)...they will ALWAYS be the same ones.

    It would be nice if the macro would automatically send the message once i have made my choice!

    LVL 76

    Expert Comment

    by:David Lee
    Thanks, Marco!  Yes, I can modify it so that the responses will always go to two addresses.  Do I understand correctly that every response will go these two addresses?  Yes, the macro can send automatically, but both addressing a message and sending a message will trigger Outlook's built in security prompts.  So many viruses and worms have been written to use Outlook as a transport mechanism that Microsoft had to add security features.  The features are tripped whenever a program/macro accesses an address field or attempts to send a message.  When this occurs Outlook presents the user with a dialog-box advising them that a program is attempting to access the user's mailbox/send a message and askign for permission to allow it to continue.  In the case of sending a message, the dialog-box has a built-in delay that forces the user to wait a few seconds before they can click yes to allow the action.  While this helps stop viruses it also makes it tough to perform legitmate actions.  There are a couple of workarounds.  One, depending on what version of Outlook you're using, you can either disable these security features or use code signing to tell Outlook that the code is ok.  That only seems to work correctly in Outlook 2003.  I've signed code in 2002/2003 and in 2002 I still get the prompts.  Of course it's possible that I've overlooked something.  Two, there's a utility called ClickYes ( that automates the process of clicking on these pop up dialog boxes.  Personally, I think that introduces a security hazard and don't recommend it.  Three, use the Redemption ( library that avoids these prompts by using Enhanced MAPI instead of Simple MAPI.  

    Let me know how you'd like to proceed and we'll take it from there.

    Author Comment

    Thank your the speedy reply BlueDevilFan!

    Yes, all the responses will be going to two address and two addresses only, no matter what reply-text is.

    THese are the situations I currently have:

    - I get a lot of e-mail that has to be forwarded to two specific addresses.  These are kinds of messages I am really trying lto deal with at the moment.  The Message that will be sent can vary somewhat, but the two addresses will always be the same ones.

    - I also get e-mail that requires a standard Reply.  Basically just replying to the sender.  Can this be handled as well with similar code?

    Being able to do the first will work wonders for me right now....

    Just out of curiiosity: would it also be possible to select the messages in the INBOX, (CTRL-click) and accomplish the same as above?
    LVL 76

    Expert Comment

    by:David Lee
    "I get a lot of e-mail that has to be forwarded ..."
    So we're forwarding and not replying?  Doesn't make a big difference, I just need to know which.

    Yes, similar code can handle both.  In fact, I might be able to do both with one macro, though I'm not absolutley certain of that.

    Yes, we can select messages from the inbox and apply the same logic.

    I'll get to work on this shortly.  Hopefully I'll have something in a day or two.

    Author Comment

    great...thank you so much!
    LVL 76

    Accepted Solution


    Here's the macro.  It's a modified version of the macro from the other question I provided the link to.  Here's how it works.  Select one or more messages and run the macro.  You can either select the message from a folder view, it doesn't have to be the Inbox, or you can act on the currently open message.  Run the macro.  It'll present you with a dialog box asking if you want to Forward the message or Reply to it.  If you select Forward, then it'll address the message to the two recipients you described.  Selecting Reply will of course address the message back to the sender.  Next, you'll be presented with a dialog asking which canned message you want to use.  Right now there are 9 canned responses defined.  You can increase or decrease that number as you desire.  I included comments in that section of the code describing what you need to do for each response.  On selecting a response the macro will prepend the associated text to the message and send it.  That all there is to it.  Here's what you'll need to do to use the macro.

    1.  Start Outlook
    2.  Click Tools->Macro->Visual Basic Editor
    3.  If not already expanded, expand Modules and click on Module1
    4.  Copy the code below and paste it into the right-hand pane of the VB Editor
    5.  Edit the code as needed.  At the very least you'll need to enter the text for each response
    6.  Click the diskette icon on the toolbar to save the changes
    7.  Close the VB Editor
    8.  Click Tools->Macro->Security
    9.  Change the Security Level setting to Medium

    If you'd like to make the macro available via a toolbar button, then follow these steps.

    1.  Click View->Toolbars->Customize
    2.  Click the Toolbars tab
    3.  Click New
    4.  Name the toolbar
    5.  Click the Commands tab
    6.  Under Categories click Macros
    7.  Under Commands click and hold on the macro Project1.SendCannedResponse, then drag it out and drop it on the new toolbar
    8.  Dock the toolbar somewhere onscreen

    Because the code is accessing an email address field and sending the message it is going to trip Outlook's built-in security.  You will either have to deal with the prompts manually, try signing the code (, or use the ClickYes utility I linked to in a prior response.

    'Macro Begins Here
    Sub SendCannedResponse()
        Dim objSelectedItems As Outlook.Selection, _
            objMessage As MailItem, _
            objOutboundMsg As MailItem, _
            intAction As Integer, _
            intResponse As Integer, _
            strResponseText As String
        Set objSelectedItems = Application.ActiveExplorer.Selection
        For Each objMessage In objSelectedItems
            If objMessage.Class = olMail Then
                intAction = Val(InputBox("Do you want to (1) Forward this message or (2) Reply to it?", "Send Canned Response Macro", 1))
                Select Case intAction
                    Case 1  'Forward the message
                        Set objOutboundMsg = objMessage.Forward
                        'Change the email address on the next two lines as needed
                        objOutboundMsg.Recipients.Add ""
                        objOutboundMsg.Recipients.Add ""
                    Case 2  'Reply to the message
                        Set objOutboundMsg = objMessage.Reply
                    Case Else
                        MsgBox "You must enter a 1 (Forward) or a 2 (Reply)." & vbCrLf & "Processing aborted.", vbExclamation, "Send Canned Response Macro"
                        Exit Sub
                End Select
                'You can change the code below to have as many or as few canned responses as you want.
                'For each response you will need a case statement matching the response number.
                'You will also want to edit the prompt in the InputBox message to reflect the number of
                'responses available.  Change the value of strResponseText to whatever you want a response
                'to say.  Because the body of the message is in HTML format you can also include HTML
                'formatting in the response text.
                intResponse = Val(InputBox("Which response (1-9) do you want to use?", "Choose a Response", 1))
                Select Case intResponse
                    Case 1
                        strResponseText = "One"
                    Case 2
                        strResponseText = "Two"
                    Case 3
                        strResponseText = "Three"
                    Case 4
                        strResponseText = "Four"
                    Case 5
                        strResponseText = "Five"
                    Case 6
                        strResponseText = "Six"
                    Case 7
                        strResponseText = "Seven"
                    Case 8
                        strResponseText = "Eight"
                    Case 9
                        strResponseText = "Nine"
                    Case Else
                        MsgBox "Invalid response.  Action cancelled.", vbExclamation, "Send Canned Response Macro"
                End Select
                If strResponseText <> "" Then
                    If objOutboundMsg.BodyFormat = olFormatHTML Then
                        objOutboundMsg.HTMLBody = strResponseText & objOutboundMsg.HTMLBody
                        objOutboundMsg.Body = strResponseText & objOutboundMsg.Body
                    End If
                End If
                MsgBox "Open item isn't a message.  Action cancelled." & vbCrLf & "This macro only works on mail items.", vbExclamation, "Send Canned Response Macro"
            End If
        Set objMessage = Nothing
        Set objOutboundMsg = Nothing
    End Sub
    'Macro Ends Here

    Author Comment

    THat works SUPERBLY!

    Thank you so much BlueDevilFan!  

    You've really spared me a lot of work!!!!
    LVL 76

    Expert Comment

    by:David Lee
    No problem.  Happy to be able to have helped out.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Get an idea of what you should include in an email disclaimer with these Top 5 email disclaimer tips.
    Outlook Free & Paid Tools
    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…
    This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

    731 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