gopalgriffith
New Member
- Joined
- Feb 21, 2024
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
All,
I am working on an "approval process" whereby colleagues will fill out a "Checklist" (an Excel workbook), and then click a button in the checklist, which generates an email (with the completed checklist attached) that then gets sent to a group mailbox for review and approval.
(Abridged) VBA code below:
The above code works beautifully.
Once an approval request comes in, the team will then correspond with the colleague / ask questions by replying to the email. Once we are ready to approve the request, the team will then click on a button in the checklist, which will record the approval in a separate register (works fine) and generate an email back to the colleague (again with the updated checklist as an attachment) confirming approval.
The problem is that the above code (or a variant thereof) works well to create a new email. But ideally, I would like approval email to be part of the existing email chain (we will know the subject line, as it was generated programmatically). That way, the entire interaction is in a single email chain, rather than the approval email being in a separate email from the rest of the interaction.
Does anyone know how I would be able to adapt the above code to reply to an existing email chain?
Cheers
Gopes
I am working on an "approval process" whereby colleagues will fill out a "Checklist" (an Excel workbook), and then click a button in the checklist, which generates an email (with the completed checklist attached) that then gets sent to a group mailbox for review and approval.
(Abridged) VBA code below:
VBA Code:
Sub ApprovalRequest()
Set oWB = ActiveWorkbook
RequestFileName = "Fin Prom Checklist - " & Sheets("Checklist").Cells(3, 3).Text & " - " & Format(Sheets("Checklist").Cells(24, 3), "YYYYMMDD") & ".xlsm"
Subject = "Fin Prom Approval Request - " & Sheets("Checklist").Cells(3, 3) & " - " & Format(Sheets("Checklist").Cells(24, 3), "YYYYMMDD")
HTMLBody = "<b><font color=red><span style='background:yellow;mso-highlight:yellow'>PLEASE TAILOR THE EMAIL FURTHER AS APPROPRIATE.</font></span></b>"
HTMLBody = HTMLBody & "<br><br><p style='font-family:arial;font-size:13'><font color = black>Dear Compliance Team,<br>Please find attached a Financial Promotion approval request.<br>I will await your approval and/or any comments you may have.<br>Regards"
Set objOutlook = CreateObject("Outlook.Application")
Set objMail = objOutlook.CreateItem(0)
With objMail
.To = "abc@def.com"
.Subject = Subject
.HTMLBody = HTMLBody
oWB.Activate
oWB.SaveCopyAs Environ("temp") & "\" & RequestFileName
.Attachments.Add (Environ("temp") & "\" & RequestFileName)
.Display
End With
Set objOutlook = Nothing
Set objMail = Nothing
End Sub
The above code works beautifully.
Once an approval request comes in, the team will then correspond with the colleague / ask questions by replying to the email. Once we are ready to approve the request, the team will then click on a button in the checklist, which will record the approval in a separate register (works fine) and generate an email back to the colleague (again with the updated checklist as an attachment) confirming approval.
The problem is that the above code (or a variant thereof) works well to create a new email. But ideally, I would like approval email to be part of the existing email chain (we will know the subject line, as it was generated programmatically). That way, the entire interaction is in a single email chain, rather than the approval email being in a separate email from the rest of the interaction.
Does anyone know how I would be able to adapt the above code to reply to an existing email chain?
Cheers
Gopes