I have previously succeeded (with the help of PEH) to create a macro that attaches the address email and workbook to the right sender. The code is in the following link address Return value of dynamically determined cell and I will pasted also below.
My manger now wants me to attach the conversation of the specific email subject (history of replies) under this macro. So when the recipient receives the email from the sender and replies by pressing the button, the email should be attached to the same Email Subject and add the history between the two parties, not just the workbook document.
I found this Excel VBA, how to Reply to a specific email message , but I am not able to understand how can I set that to my own code.
Can this be done to what I have or the structure of the code should be change?
Sub mail()
Dim A As Long
Dim sh1 As Worksheet
Dim sh2 As Worksheet
Dim wb As Workbook
Dim check
Set wb = Excel.ActiveWorkbook
Set sh1 = wb.Worksheets(1)
Set sh2 = wb.Worksheets(2)
For A = 2 To sh1.Cells(Rows.Count, "A").End(xlUp).Row
check = Application.match(sh1.Cells(A, 1).Value, sh2.Columns(1), 0)
If IsError(check) And Not IsEmpty(sh1.Cells(A, 1)) Then
MsgBox "No email was found!"
Else
h = sh2.Cells(check, 2).Value
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.createItem(olmailitem)
Set wb2 = ActiveWorkbook
wb.Save
With OutMail
.Display
.To = h
.cc = ""
.BCC = ""
.Subject = "Test - "
.htmlbody = "<p style='font-family:calibri;font-size:15'>" & "Hi " & C & "<BR/>" & "<BR/>" & "Please check the attached template." & "<br/>" & "<BR/>" & "Change data if required." & "<BR/>" & "<br/>" & "This e-mail has been automatically send! " & "<br/>" & "<br/>" & "With best regards," & "<br/>" & "<br/>"
.attachments.Add wb2.FullName
End With
wb.Close
End If
Next
End Sub