Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

press button reply to email with attachment

Posted on 2013-06-22
7
Medium Priority
?
378 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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 
LVL 76

Accepted Solution

by:
David Lee earned 2000 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

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

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

What does UTC stand for?  “Coordinated Universal Time” – Think of this as the true time on Planet Earth that never changes with the exception of minor leap seconds here and there to account for the changes in the planet's rotation.   What does th…
How to resolve IMCEAEX NDRs in Exchange or Exchange Online related to invalid X500 addresses.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

721 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