When you reply to an email in Outlook, the original emails are not included. This is because it is assumed that the original sender still has access to the original attachments.
There are however various valid scenarios in which it makes sense to keep the attachments. A common scenario which would benefit from this, is in longer mail threads where Reply All is used and where new people are being added.
Although there are various workarounds available, having this option integrated in Outlook is more efficient.
This guide contains the following integrated solutions;
- VBA macro 1: Integrated with the standard Reply and Reply All commands
- VBA macro 2: Separate Reply / Reply All with Attachments commands
- Add-in: ReplyWithAtt by IvaSoft
VBA macro 1: Integrated with the standard Reply and Reply All commands
This first VBA macro is an all-in-one macro which does the following;
- When pressing the standard Reply or Reply All button, it will detect whether the message you are replying to has any attachments. When it does, it will prompt you whether to add them or not.
- You can configure the macro to skip this prompt and always add the original attachments. You can configure this independently for the Reply and Reply All commands.
- Optionally, you can add dedicated commands for “Reply with Attachments” and “Reply All with Attachments”. If this is the only thing that you need, it is recommended to use the second macro instead.
Easily choose to keep your attachments when replying.
Quick Install
Use the following instructions to configure the macro in Outlook;
- Download this code-file (
replywithattachments.zip
) and copy the code from theReplyWithAttachments.txt
file or copy the code below. - Open the VBA Editor (keyboard shortcut ALT+F11)
- Paste the copied code in the ThisOutlookSession module.
- Sign your code so you won’t get any security prompts and the macro won’t get disabled.
- Restart Outlook to activate the macro as it relies on Event Handlers.
- Optionally; Add buttons to create dedicated “Reply with Attachments” and “Reply All with Attachments” commands as well.
ThisOutlookSession module in the VBA Editor.
Macro Code
The following code is contained in the zip-file referenced in the Quick Install. You can use the code below for review or manual installation.
'=============================================================================== 'Description: Outlook macro to include the original attachments when replying. ' ' author : Robert Sparnaaij ' version: 1.0 ' website: https://www.howto-outlook.com/howto/reply-with-attachments.htm '=============================================================================== Public WithEvents objInspectors As Outlook.Inspectors Public WithEvents myOlExp As Outlook.Explorer Public WithEvents myItem As Outlook.MailItem Private DisableEvents As Boolean Private Sub Application_Startup() Initialize_handler End Sub Public Sub Initialize_handler() Set objInspectors = Application.Inspectors Set myOlExp = Application.ActiveExplorer DisableEvents = False End Sub Private Sub objInspectors_NewInspector(ByVal Inspector As Inspector) Dim objApp As Outlook.Application Set objApp = Application On Error Resume Next Select Case TypeName(objApp.ActiveWindow) Case "Explorer" Set myItem = objApp.ActiveExplorer.Selection.Item(1) Case "Inspector" Set myItem = objApp.ActiveInspector.CurrentItem End Select Set objApp = Nothing End Sub Private Sub myOlExp_SelectionChange() On Error Resume Next Set myItem = myOlExp.Selection.Item(1) End Sub Private Sub myItem_Reply(ByVal Response As Object, Cancel As Boolean) Call AddOriginalAttachmentsPrompt(Response, True) End Sub Private Sub myItem_ReplyAll(ByVal Response As Object, Cancel As Boolean) Call AddOriginalAttachmentsPrompt(Response, True) End Sub Public Sub AddOriginalAttachmentsPrompt(ByVal Response As Object, Prompt As Boolean) If myItem.Attachments.Count > 0 And DisableEvents = False Then If Prompt = True Then strPrompt = "The original email has attachments." & _ vbNewLine & "Do you want to include these in your reply?" Result = MsgBox(strPrompt, vbQuestion + vbYesNo + vbDefaultButton1, _ "Reply with Attachments") Else Result = vbYes End If If Result = vbYes Then Call AddOriginalAttachments(Response) End If End If End Sub Public Sub AddOriginalAttachments(ByVal Response As Object) Set myAttachments = Response.Attachments Set fso = CreateObject("Scripting.FileSystemObject") Set fldTemp = fso.GetSpecialFolder(2) ' User Temp Folder strPath = fldTemp.Path & "\" For Each Attachment In myItem.Attachments strFile = strPath & Attachment.FileName Attachment.SaveAsFile strFile myAttachments.Add strFile, , , Attachment.DisplayName fso.DeleteFile strFile Next Set fldTemp = Nothing Set fso = Nothing Set myAttachments = Nothing End Sub Sub ReplyWithAttachments() DisableEvents = True Set myReply = myItem.Reply Call AddOriginalAttachments(myReply) myReply.Display myItem.UnRead = False DisableEvents = False Set myReply = Nothing End Sub Sub ReplyAllWithAttachments() DisableEvents = True Set myReply = myItem.ReplyAll Call AddOriginalAttachments(myReply) myReply.Display myItem.UnRead = False DisableEvents = False Set myReply = Nothing End Sub
Modifications
The macro allows for some modifications that are easy to implement.
As the entire macro code is relatively long, it is best to use the search feature. No matter whether you are looking at this code in your Internet Browser, Notepad or the VBA Editor in Outlook, pressing CTRL+F will open the search dialog.
Modification 1: Making “No” the default
To make “No” the default in the prompt look for;
vbQuestion + vbYesNo + vbDefaultButton1,
and change it into;
vbQuestion + vbYesNo,
Modification 2: Disable the prompt
To disable the prompt completely and always attach the original attachments, look for;
Call AddOriginalAttachmentsPrompt(Response, True)
and change it into;
Call AddOriginalAttachmentsPrompt(Response, False)
VBA macro 2: Separate Reply / Reply All with Attachments commands
In case you don’t need to have it integrated with the default Reply and Reply All commands of Outlook, then you can use the VBA macro below.
This VBA macro code is less complicated and is easier to implement when you already have other code and custom events in your ThisOutlookSession module.
Quick Install
Use the following instructions to configure the macro in Outlook;
- Download this code-file (
replywithattachments.zip
) and or copy the code below. - Open the VBA Editor (keyboard shortcut ALT+F11)
- Extract the zip-file and import the
ReplyWithAttachments.bas
file via File-> Import…
If you copied the code, paste it into a new module. - Sign your code so you won’t get any security prompts and the macro won’t get disabled.
- Add a button for easy access to the macro or press ALT+F8 and select the macro you want to execute.
Add a button of the macro to the QAT or Ribbon for quick access to it.
Macro Code
The following code is contained in the zip-file referenced in the Quick Install. You can use the code below for review or manual installation.
Sub ReplyWithAttachments() ReplyAndAttach (False) End Sub Sub ReplyAllWithAttachments() ReplyAndAttach (True) End Sub Function GetCurrentItem() As Object Dim objApp As Outlook.Application Set objApp = Application On Error Resume Next Select Case TypeName(objApp.ActiveWindow) Case "Explorer" Set GetCurrentItem = objApp.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = objApp.ActiveInspector.CurrentItem End Select Set objApp = Nothing End Function Public Sub AddOriginalAttachments(ByVal myItem As Object, ByVal myResponse As Object) Set MyAttachments = myResponse.Attachments Set fso = CreateObject("Scripting.FileSystemObject") Set fldTemp = fso.GetSpecialFolder(2) ' User Temp Folder strPath = fldTemp.Path & "\" For Each Attachment In myItem.Attachments strFile = strPath & Attachment.FileName Attachment.SaveAsFile strFile MyAttachments.Add strFile, , , Attachment.DisplayName fso.DeleteFile strFile Next Set fldTemp = Nothing Set fso = Nothing Set MyAttachments = Nothing End Sub Public Sub ReplyAndAttach(ByVal ReplyAll As Boolean) Dim myItem As Outlook.MailItem Dim oReply As Outlook.MailItem Set myItem = GetCurrentItem() If Not myItem Is Nothing Then If ReplyAll = False Then Set oReply = myItem.Reply Else Set oReply = myItem.ReplyAll End If AddOriginalAttachments myItem, oReply oReply.Display myItem.UnRead = False End If Set oReply = Nothing Set myItem = Nothing End Sub
Add-in: ReplyWithAtt by IvaSoft
Another approach would be to do this via an add-in.
ReplyWithAtt by IvaSoft integrates with the default Reply and Reply All commands of Outlook and changes their behavior to also include the original attachment(s).
Because of this, the add-in is super-simple to operate. There are no visual changes and nothing needs to be configured once it is installed; It works straight out-of-the box!