Solved

press button reply to email with attachment

Posted on 2013-06-22
7
373 Views
Last Modified: 2013-06-24
I receive a lot of emails to which I need to provide a common textual reply with an attachment. At the moment I am inserting a customised signature, deleting the two unwanted blank lines it installs at the top and then manually attaching the file I need to send. I would prefer to have a button or some other easy to implement trigger that simply does it for me with the currently selected email. Is there any way I can do this? I am using Outlook 2007
0
Comment
Question by:Rob4077
[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
  • 4
  • 3
7 Comments
 

Author Comment

by:Rob4077
ID: 39268001
Just to clarify, the text I need to insert in the selected emails is something like:
     "Thank you for your email. .... As requested, attached is a copy of the latest report. ..."

I then attach the report. I would like a VBA module or something that will enable me to do this at the push of a button
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39270783
Hi, Rob4077.

This should do it.  Follow these instructions to add the macro to Outlook.

1.  Start Outlook
2.  Press ALT+F11 to open the Visual Basic editor
3.  If not already expanded, expand Microsoft Office Outlook Objects
4.  If not already expanded, expand Modules
5.  Select an existing module (e.g. Module1) by double-clicking on it or create a new module by right-clicking Modules and selecting Insert > Module.
6.  Copy the code from the Code Snippet box and paste it into the right-hand pane of Outlook's VB Editor window
7.  Edit the code as needed.  I included comments wherever something needs to or can change
8.  Click the diskette icon on the toolbar to save the changes
9.  Close the VB Editor

Sub ReplyWithAttachment()
    'On the next line edit the text you want to insert into the reply
    Const REPLY_TEXT = "The text of your reply."
    'On the next line edit the path to and name of the file you want to attach to your reply
    Const ATTACH_PATH = "C:\Test.txt"
    Dim olkMsg As Outlook.MailItem, olkRpl As Outlook.MailItem
    Set olkMsg = Application.ActiveExplorer.Selection(1)
    Set olkRpl = olkMsg.Reply
    With olkRpl
        Select Case olkRpl.BodyFormat
            Case olFormatHTML
                olkRpl.HTMLBody = REPLY_TEXT & olkRpl.HTMLBody
            Case Else
                olkRpl.Body = REPLY_TEXT & olkRpl.Body
        End Select
        olkRpl.Attachments.Add ATTACH_PATH
        olkRpl.Send
    End With
    Set olkMsg = Nothing
    Set olkRpl = Nothing
End Sub

Open in new window

0
 

Author Comment

by:Rob4077
ID: 39271420
That worked perfectly. Thank you!!! You've got full points

Since it worked so well, is it too much to ask for two changes (assuming it's not a mass of extra work).

1. Is it difficult to move the email to a subfolder of the Inbox called DeleteIn1Month?

2. Is there any way of preventing Outlook from adding the standard email signature on the reply?

If either is too difficult or involves a lot of extra coding just let me know and I will happily work with what you have done for me already
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 39271521
You're welcome.

Moving the message is no problem.  I'm assuming you want to  move the original message and not the reply you just sent.  Assuming so, then this version adds that capability.

Sub ReplyWithAttachment()
    'On the next line edit the text you want to insert into the reply
    Const REPLY_TEXT = "The text of your reply."
    'On the next line edit the path to and name of the file you want to attach to your reply
    Const ATTACH_PATH = "C:\Test.txt"
    Dim olkMsg As Outlook.MailItem, olkRpl As Outlook.MailItem
    Set olkMsg = Application.ActiveExplorer.Selection(1)
    Set olkRpl = olkMsg.Reply
    With olkRpl
        Select Case olkRpl.BodyFormat
            Case olFormatHTML
                olkRpl.HTMLBody = REPLY_TEXT & olkRpl.HTMLBody
            Case Else
                olkRpl.Body = REPLY_TEXT & olkRpl.Body
        End Select
        olkRpl.Attachments.Add ATTACH_PATH
        olkRpl.Send
        olkMsg.Move Session.GetDefaultFolder(olFolderInbox).Folders("DeleteIn1Month")
    End With
    Set olkMsg = Nothing
    Set olkRpl = Nothing
End Sub

Open in new window

     

I don't know of a way to prevent Outlook from adding the standard signature  to the reply.
0
 

Author Comment

by:Rob4077
ID: 39271567
Thank you very, very much. This will save me hours of work every month. Really appreciate it!!!
0
 
LVL 76

Expert Comment

by:David Lee
ID: 39271631
You're welcome.  I'm happy I could help out.
0
 

Author Comment

by:Rob4077
ID: 39271687
I'm very happy you did help so much
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

Suggested Solutions

MS Outlook is a world-class email client application that is mainly used for e-communication globally.  In this article, we will discuss the basic idea about MS Outlook, its advanced features, and types of MS Outlook File formats.
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
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 …
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 https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

734 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