PDA

View Full Version : Review all Email Recipients before Sending



rallison0902
01-12-2024, 08:05 AM
Hi team, I have some experience in VBA but I'm rusty and trying to recreate a macros from years ago to display all email recipients prior to sending. So, essentially, a pop-up box would appear when the send button is clicked that will list all the recipients for one last review and a confirmation to send. Any thoughts?

Aussiebear
01-12-2024, 01:36 PM
Try this one


Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim Prompt As String
Prompt = "Are you sure you entered all correct recipients?"
If MsgBox(Prompt, vbYesNo + vbQuestion + vbMsgBoxSetForeground, "Check for recipients") = vbNo Then
Cancel = True
End If
End Sub

jdelano
01-13-2024, 01:14 AM
will list all the recipients for one last review

As a small add-on to Aussiebear's response, for the list of recipients, use the Item object which will be a MailItem (https://learn.microsoft.com/en-us/office/vba/api/Outlook.MailItem) you could add a string that contains the list that is displayed with the message asking if they are all correct.



Dim recipientList as String
Dim rp as Outlook.Recipient

recipientList = ""
For Each rp in Item.Recipients
recipientList = recipientList & rp.Name & vbCrLf
Next

Prompt = recipientList & "Are you sure you entered all correct recipients?"


This code hasn't been tested and is just an example.

Aussiebear
01-13-2024, 12:24 PM
:sleep2:

jdelano
01-14-2024, 01:40 AM
Teamwork!

Aussiebear
01-14-2024, 03:17 AM
yes, but the Captain/Coach of the home team appears to have subbed themselves out of the game..... Strange method of asking for help and then just disappear.

rallison0902
02-23-2024, 03:10 AM
HA! Didn't disappear - apologies for the delay. I can't thank you enough for your help. Testing this morning and will check back in! :)