multiple emails

mborg

New Member
Joined
Nov 22, 2010
Messages
43
I have following code in a form which triggers an email of a particular report. the problem with this is, for each recipient, we need to run the following macro for each email which then prompts for a particular employee. is it possible to have the ability to generate multiple emails in one click?

Private Sub Mail_Reimbursement_Summary_Click()
On Error GoTo Err_Mail_Reimbursement_Summary_Click


Dim stDocName As String


stDocName = "Tuition Reimbursement Summary Report"
DoCmd.SendObject acReport, stDocName, , , , , "Reimbursement Summary", "Hi, See attached for your recent Course Resimbursement."




Exit_Mail_Reimbursement_Summary_Click:
Exit Sub


Err_Mail_Reimbursement_Summary_Click:
MsgBox Err.Description
Resume Exit_Mail_Reimbursement_Summary_Click

End Sub
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
It is possible to generate multiple emails at once, but we will need more details. Are all the emails to the one person? If not then what are you looping through to decide what is to be included in each and how do you know who it has to go to?

A couple notes on the SendObject:

There are arguments you have left blank that may be beneficial to complete. The Format argument should save the dialog asking you what format you want and the To argument should be able to take a reference to your form if the email address is on the form.

Code:
DoCmd.SendObject acSendReport, stDocName, [COLOR=#0000cd]acFormatPDF[/COLOR], [COLOR=#ff0000]Me.email[/COLOR], , , "Reimbursement Summary", "Hi, See attached for your recent Course Resimbursement"
Me.email - should be replaced with the appropriate field on your form or removed to leave blank
AcFormatPDF can be changed if you usually send a different format.

See here for more details on SendObject

Unfortunately using this method to send the email will need to display the email for you to hit send or if the final argument (Edit) is set to False usually gives a security warning forcing you to hit allow for the email to be sent.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,221,691
Messages
6,161,325
Members
451,697
Latest member
pedroDH

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top