Solved

press button reply to email with attachment

Posted on 2013-06-22
7
367 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
  • 4
  • 3
7 Comments
 

Author Comment

by:Rob4077
Comment Utility
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
Comment Utility
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
Comment Utility
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
Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
You're welcome.  I'm happy I could help out.
0
 

Author Comment

by:Rob4077
Comment Utility
I'm very happy you did help so much
0

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

Set OWA language and time zone in Exchange for individuals, all users or per database.
Outlook Free & Paid Tools
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 …
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…

762 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

7 Experts available now in Live!

Get 1:1 Help Now