As you know while you are using outlook and reply to an email message, the original attachments is not included on the replied message.
So, I have used the below code and it works correctly, except it adds sometimes extra redundant Images to the new message.
I found that these images have the same name pattern , image & number & .png or Jpg ,like image001.png , image002.png , image003.Jpg , and so on.
These extra images is indeed the pictures of signature of other persons of the original email.
I need to amend the below code to delete these extra redundant Images
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)
Dim MyAttachments As Variant
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