VBA Email Loop? (1 Viewer)

Prototype

Registered User.
Local time
Today, 07:26
Joined
Mar 26, 2017
Messages
11
Hello everyone,

I would like to use a button to send an email to each person listed in the query using Microsoft Outlook. The email will contain a report as a PDF attachment, which provide details about individual records.

Would something like this require VBA?

Thank you.
 
Last edited:

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 06:26
Joined
Feb 28, 2001
Messages
27,131
If everyone is getting the same report, the only loop has to be when you populate the "To" list (or "CC" list, if applicable). If it IS the same report, multiple recipients becomes easy. But... IF it is ALWAYS the same set of recipients, there is such a thing as sending to a pre-defined mailing list.

If the reports are different for each person, that is of course a different story.
 

jdraw

Super Moderator
Staff member
Local time
Today, 07:26
Joined
Jan 23, 2006
Messages
15,379
@prototype

Would something like this require VBA?

Yes. But the logic involved is dependent on the answers to questions asked by Doc_Man.

There are samples and articles (including youtube) that can be found via google/bing. The Steve Bishop youtube videos are great --as is his entire vba series.

You may also get some info from this BlueClaw link.

Good luck with your project.
 
Last edited:

Prototype

Registered User.
Local time
Today, 07:26
Joined
Mar 26, 2017
Messages
11
If everyone is getting the same report, the only loop has to be when you populate the "To" list (or "CC" list, if applicable). If it IS the same report, multiple recipients becomes easy. But... IF it is ALWAYS the same set of recipients, there is such a thing as sending to a pre-defined mailing list.

If the reports are different for each person, that is of course a different story.

The reports are different for each individual. Each person will be getting their own.
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 12:26
Joined
Jul 9, 2003
Messages
16,271
The reports are different for each individual. Each person will be getting their own.

The original post was basically and enquiry as to if this was at all possible. However I get the impression you are sort of drip feeding the rest of the necessary information, possibly because you haven't really thought it through.

To help you formulate a better request for help I have listed here some questions that occur to me.

The report:-
Is it a report consisting of exactly the same layout for each person but having a different set of records Returned? Let's term this "The same report with different records" to make it easier to discuss in future posts.

If the reports are all different in format and structure, then how are they being created? Do they already exist? How are you creating them, with code, something else? Let's term this "Individual Bespoke Reports"

If it's the first case:-
"The same report with different records"

Then how are you changing the records Returned? With a query, an SQL statement, a filter? Something else?

If it's the second case:-
"Individual Bespoke Reports"

How are you associating the report with the person that is to receive the a report?

If there's something else, or I've missed something then please add or provide more information
 
Last edited:

1268

Registered User.
Local time
Today, 06:26
Joined
Oct 11, 2012
Messages
44
Yes use vba.

Build a who loop and call the what function with the who variable.

Build a what function getting the what based on the who. Call the email function with what and who.

Build an e-mail function based on who and what.

In this way you can have the flexibility to send to groups or individuals or in between and change attachments individually or as a group.

You will need to know how to build a record set and loop through it, call another function with a variable from another, and send an email with an attachment.

All of these things can be found easily with a little searching and using provided links in prior posts.

If you get stuck on specific code as you start post it here and someone will help.

Sent from my SM-G950U using Tapatalk
 

Users who are viewing this thread

Top Bottom